summaryrefslogtreecommitdiffstats
path: root/fs/ceph/mds_client.c
diff options
context:
space:
mode:
authorYan, Zheng2017-09-08 09:23:18 +0200
committerIlya Dryomov2017-11-13 12:11:11 +0100
commit89aa593010135660991d05c92528c2c9163d5900 (patch)
treeca9baae50ad10f9523a290ec2f7081eca8257772 /fs/ceph/mds_client.c
parentLinux 4.14 (diff)
downloadkernel-qcow2-linux-89aa593010135660991d05c92528c2c9163d5900.tar.gz
kernel-qcow2-linux-89aa593010135660991d05c92528c2c9163d5900.tar.xz
kernel-qcow2-linux-89aa593010135660991d05c92528c2c9163d5900.zip
ceph: keep auth cap when inode has flocks or posix locks
file locks are tracked by inode's auth mds. dropping auth caps is equivalent to releasing all file locks. Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r--fs/ceph/mds_client.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 0687ab3c3267..c8a811db387a 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1462,6 +1462,11 @@ static int trim_caps_cb(struct inode *inode, struct ceph_cap *cap, void *arg)
goto out;
if ((used | wanted) & CEPH_CAP_ANY_WR)
goto out;
+ /* Note: it's possible that i_filelock_ref becomes non-zero
+ * after dropping auth caps. It doesn't hurt because reply
+ * of lock mds request will re-add auth caps. */
+ if (atomic_read(&ci->i_filelock_ref) > 0)
+ goto out;
}
/* The inode has cached pages, but it's no longer used.
* we can safely drop it */