X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=fs%2Fceph%2Fexport.c;h=e088843a7734c03592adfe0ec962ed1c71d85a5a;hb=cea6575fdccfc0624ca42f656e16e6b4d9bb48a5;hp=79dc06881e78e20fa0a568d570da009d3dc6cfeb;hpb=a5c33d5f745ca1ecfbd692a531ef2a12bfeeb57e;p=linux-2.6-microblaze.git diff --git a/fs/ceph/export.c b/fs/ceph/export.c index 79dc06881e78..e088843a7734 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c @@ -172,9 +172,16 @@ struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino) static struct dentry *__fh_to_dentry(struct super_block *sb, u64 ino) { struct inode *inode = __lookup_inode(sb, ino); + int err; + if (IS_ERR(inode)) return ERR_CAST(inode); - if (inode->i_nlink == 0) { + /* We need LINK caps to reliably check i_nlink */ + err = ceph_do_getattr(inode, CEPH_CAP_LINK_SHARED, false); + if (err) + return ERR_PTR(err); + /* -ESTALE if inode as been unlinked and no file is open */ + if ((inode->i_nlink == 0) && (atomic_read(&inode->i_count) == 1)) { iput(inode); return ERR_PTR(-ESTALE); }