Skip to content

Commit

Permalink
ceph: send LSSNAP request to auth mds of directory inode
Browse files Browse the repository at this point in the history
Snapdir inode has no capability. __choose_mds() should choose mds
base on capabilities of snapdir's parent inode.

Signed-off-by: "Yan, Zheng" <[email protected]>
Signed-off-by: Ilya Dryomov <[email protected]>
  • Loading branch information
ukernel authored and idryomov committed Sep 6, 2017
1 parent 8d45b91 commit 5d37ca1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions fs/ceph/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,10 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)
}
/* hints to request -> mds selection code */
req->r_direct_mode = USE_AUTH_MDS;
req->r_direct_hash = ceph_frag_value(frag);
__set_bit(CEPH_MDS_R_DIRECT_IS_HASH, &req->r_req_flags);
if (op == CEPH_MDS_OP_READDIR) {
req->r_direct_hash = ceph_frag_value(frag);
__set_bit(CEPH_MDS_R_DIRECT_IS_HASH, &req->r_req_flags);
}
if (fi->last_name) {
req->r_path2 = kstrdup(fi->last_name, GFP_KERNEL);
if (!req->r_path2) {
Expand Down
13 changes: 10 additions & 3 deletions fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,16 @@ static int __choose_mds(struct ceph_mds_client *mdsc,

inode = NULL;
if (req->r_inode) {
inode = req->r_inode;
ihold(inode);
} else if (req->r_dentry) {
if (ceph_snap(req->r_inode) != CEPH_SNAPDIR) {
inode = req->r_inode;
ihold(inode);
} else {
/* req->r_dentry is non-null for LSSNAP request.
* fall-thru */
WARN_ON_ONCE(!req->r_dentry);
}
}
if (!inode && req->r_dentry) {
/* ignore race with rename; old or new d_parent is okay */
struct dentry *parent;
struct inode *dir;
Expand Down

0 comments on commit 5d37ca1

Please sign in to comment.