Skip to content

Commit 5d37ca1

Browse files
ukernelidryomov
authored andcommitted
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>
1 parent 8d45b91 commit 5d37ca1

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

fs/ceph/dir.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,10 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
377377
}
378378
/* hints to request -> mds selection code */
379379
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+
}
382384
if (fi->last_name) {
383385
req->r_path2 = kstrdup(fi->last_name, GFP_KERNEL);
384386
if (!req->r_path2) {

fs/ceph/mds_client.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,9 +731,16 @@ static int __choose_mds(struct ceph_mds_client *mdsc,
731731

732732
inode = NULL;
733733
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) {
737744
/* ignore race with rename; old or new d_parent is okay */
738745
struct dentry *parent;
739746
struct inode *dir;

0 commit comments

Comments
 (0)