diff options
author | Jeff Layton <jlayton@kernel.org> | 2019-04-02 08:04:30 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2020-03-30 12:42:40 +0200 |
commit | f85122afeb230b4ad0b90ac40aba0fe6532baeea (patch) | |
tree | 18f4111a409899f7b05b795912fea24d0e6c9eac /fs/ceph/caps.c | |
parent | 3db0a2fc5668c6dc60218e0f55d2443bcd726aa0 (diff) |
ceph: add refcounting for Fx caps
In future patches we'll be taking and relying on Fx caps. Add proper
refcounting for them.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 28ae0c134700..1a17f19fd8ad 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -965,6 +965,8 @@ int __ceph_caps_used(struct ceph_inode_info *ci) used |= CEPH_CAP_FILE_WR; if (ci->i_wb_ref || ci->i_wrbuffer_ref) used |= CEPH_CAP_FILE_BUFFER; + if (ci->i_fx_ref) + used |= CEPH_CAP_FILE_EXCL; return used; } @@ -2500,6 +2502,8 @@ static void __take_cap_refs(struct ceph_inode_info *ci, int got, ci->i_rd_ref++; if (got & CEPH_CAP_FILE_CACHE) ci->i_rdcache_ref++; + if (got & CEPH_CAP_FILE_EXCL) + ci->i_fx_ref++; if (got & CEPH_CAP_FILE_WR) { if (ci->i_wr_ref == 0 && !ci->i_head_snapc) { BUG_ON(!snap_rwsem_locked); @@ -2911,6 +2915,9 @@ void ceph_put_cap_refs(struct ceph_inode_info *ci, int had) if (had & CEPH_CAP_FILE_CACHE) if (--ci->i_rdcache_ref == 0) last++; + if (had & CEPH_CAP_FILE_EXCL) + if (--ci->i_fx_ref == 0) + last++; if (had & CEPH_CAP_FILE_BUFFER) { if (--ci->i_wb_ref == 0) { last++; |