summaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-03-10 10:19:28 +0100
committerIngo Molnar <mingo@kernel.org>2018-03-10 10:19:28 +0100
commitd88f1f1fdb9f8f60602b406c89342e113a19df7f (patch)
tree16da02010b66f7f54fde737c5c54e43980789f79 /fs/ceph/caps.c
parent04860d48a8aba5b21ae5ba1f86b0d4e3bc628fff (diff)
parentcdb06e9d8f520c969676e7d6778cffe5894f079f (diff)
downloadlinux-stable-d88f1f1fdb9f8f60602b406c89342e113a19df7f.tar.gz
linux-stable-d88f1f1fdb9f8f60602b406c89342e113a19df7f.tar.bz2
linux-stable-d88f1f1fdb9f8f60602b406c89342e113a19df7f.zip
Merge branch 'linus' into locking/core, to pick up fixes and dependencies
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r--fs/ceph/caps.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 6582c4507e6c..0e5bd3e3344e 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -3965,6 +3965,32 @@ void ceph_put_fmode(struct ceph_inode_info *ci, int fmode)
}
/*
+ * For a soon-to-be unlinked file, drop the AUTH_RDCACHE caps. If it
+ * looks like the link count will hit 0, drop any other caps (other
+ * than PIN) we don't specifically want (due to the file still being
+ * open).
+ */
+int ceph_drop_caps_for_unlink(struct inode *inode)
+{
+ struct ceph_inode_info *ci = ceph_inode(inode);
+ int drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL;
+
+ spin_lock(&ci->i_ceph_lock);
+ if (inode->i_nlink == 1) {
+ drop |= ~(__ceph_caps_wanted(ci) | CEPH_CAP_PIN);
+
+ ci->i_ceph_flags |= CEPH_I_NODELAY;
+ if (__ceph_caps_dirty(ci)) {
+ struct ceph_mds_client *mdsc =
+ ceph_inode_to_client(inode)->mdsc;
+ __cap_delay_requeue_front(mdsc, ci);
+ }
+ }
+ spin_unlock(&ci->i_ceph_lock);
+ return drop;
+}
+
+/*
* Helpers for embedding cap and dentry lease releases into mds
* requests.
*