Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: send LSSNAP request to auth mds of directory inode

Snapdir inode has no capability. __choose_mds() should choose mds
base on capabilities of snapdir's parent inode.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

authored by

Yan, Zheng and committed by
Ilya Dryomov
5d37ca14 8d45b911

+14 -5
+4 -2
fs/ceph/dir.c
··· 377 377 } 378 378 /* hints to request -> mds selection code */ 379 379 req->r_direct_mode = USE_AUTH_MDS; 380 - req->r_direct_hash = ceph_frag_value(frag); 381 - __set_bit(CEPH_MDS_R_DIRECT_IS_HASH, &req->r_req_flags); 380 + if (op == CEPH_MDS_OP_READDIR) { 381 + req->r_direct_hash = ceph_frag_value(frag); 382 + __set_bit(CEPH_MDS_R_DIRECT_IS_HASH, &req->r_req_flags); 383 + } 382 384 if (fi->last_name) { 383 385 req->r_path2 = kstrdup(fi->last_name, GFP_KERNEL); 384 386 if (!req->r_path2) {
+10 -3
fs/ceph/mds_client.c
··· 731 731 732 732 inode = NULL; 733 733 if (req->r_inode) { 734 - inode = req->r_inode; 735 - ihold(inode); 736 - } else if (req->r_dentry) { 734 + if (ceph_snap(req->r_inode) != CEPH_SNAPDIR) { 735 + inode = req->r_inode; 736 + ihold(inode); 737 + } else { 738 + /* req->r_dentry is non-null for LSSNAP request. 739 + * fall-thru */ 740 + WARN_ON_ONCE(!req->r_dentry); 741 + } 742 + } 743 + if (!inode && req->r_dentry) { 737 744 /* ignore race with rename; old or new d_parent is okay */ 738 745 struct dentry *parent; 739 746 struct inode *dir;