Commit 3886274a authored by Luis Henriques's avatar Luis Henriques Committed by Ilya Dryomov

ceph: factor out ceph_lookup_inode()

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: default avatarLuis Henriques <lhenriques@suse.com>
Reviewed-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 1b52931c
...@@ -59,7 +59,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, ...@@ -59,7 +59,7 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len,
return type; 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 ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
struct inode *inode; struct inode *inode;
...@@ -91,13 +91,23 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) ...@@ -91,13 +91,23 @@ static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino)
ihold(inode); ihold(inode);
ceph_mdsc_put_request(req); ceph_mdsc_put_request(req);
if (!inode) if (!inode)
return ERR_PTR(-ESTALE); return err < 0 ? ERR_PTR(err) : ERR_PTR(-ESTALE);
if (inode->i_nlink == 0) { if (inode->i_nlink == 0) {
iput(inode); iput(inode);
return ERR_PTR(-ESTALE); 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); return d_obtain_alias(inode);
} }
......
...@@ -1082,6 +1082,7 @@ extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg); ...@@ -1082,6 +1082,7 @@ extern long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
/* export.c */ /* export.c */
extern const struct export_operations ceph_export_ops; extern const struct export_operations ceph_export_ops;
struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino);
/* locks.c */ /* locks.c */
extern __init void ceph_flock_init(void); extern __init void ceph_flock_init(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment