Skip to content

Commit

Permalink
ceph: factor out ceph_lookup_inode()
Browse files Browse the repository at this point in the history
This function will be used by __fh_to_dentry and by the quotas code, to
find quota realm inodes that are not visible in the mountpoint.

Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
  • Loading branch information
Luis Henriques authored and Ilya Dryomov committed May 7, 2019
1 parent 1b52931 commit 3886274
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions fs/ceph/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
return type;
}

static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino)
{
struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
struct inode *inode;
Expand Down Expand Up @@ -91,13 +91,23 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
ihold(inode);
ceph_mdsc_put_request(req);
if (!inode)
return ERR_PTR(-ESTALE);
return err < 0 ? ERR_PTR(err) : ERR_PTR(-ESTALE);
if (inode->i_nlink == 0) {
iput(inode);
return ERR_PTR(-ESTALE);
}
}

return inode;
}

static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
{
struct inode *inode = ceph_lookup_inode(sb, ino);

if (IS_ERR(inode))
return ERR_CAST(inode);

return d_obtain_alias(inode);
}

Expand Down
1 change: 1 addition & 0 deletions fs/ceph/super.h
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg);

/* export.c */
extern const struct export_operations ceph_export_ops;
struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino);

/* locks.c */
extern __init void ceph_flock_init(void);
Expand Down

0 comments on commit 3886274

Please sign in to comment.