From: Sage Weil Date: Mon, 23 Aug 2010 04:33:32 +0000 (-0700) Subject: ceph: don't improperly set dir complete when holding EXCL cap X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=124514918b030d74f1f3e15483b7bf3b85268082;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git ceph: don't improperly set dir complete when holding EXCL cap If we hold the EXCL cap, we cannot trust the dir stats from the MDS (num files, subdirs) and must not incorrectly conclude that the directory is empty. If we do, we get can bad results from lookup (bad ENOENT) and bad readdir results. Signed-off-by: Sage Weil --- diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 5d893d31e39..3e6b52cb5ee 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -677,6 +677,7 @@ static int fill_inode(struct inode *inode, if (ci->i_files == 0 && ci->i_subdirs == 0 && ceph_snap(inode) == CEPH_NOSNAP && (le32_to_cpu(info->cap.caps) & CEPH_CAP_FILE_SHARED) && + (issued & CEPH_CAP_FILE_EXCL) == 0 && (ci->i_ceph_flags & CEPH_I_COMPLETE) == 0) { dout(" marking %p complete (empty)\n", inode); ci->i_ceph_flags |= CEPH_I_COMPLETE;