diff options
author | Yan, Zheng <ukernel@gmail.com> | 2020-02-18 16:17:08 +0300 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2020-03-30 13:42:41 +0300 |
commit | 173e70e8ac0f1e7e3eb98f1ffb953e80a5cc8a5f (patch) | |
tree | e91e2cd1e6515ab4f1e56e0650930bb0dfe2fc9f /fs/ceph | |
parent | a25949b99003b7e6c2604a3fc8b8d62385508477 (diff) | |
download | linux-173e70e8ac0f1e7e3eb98f1ffb953e80a5cc8a5f.tar.xz |
ceph: don't take refs to want mask unless we have all bits
If we don't have all of the cap bits for the want mask in
try_get_cap_refs, then just take refs on the need bits.
Signed-off-by: "Yan, Zheng" <ukernel@gmail.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/caps.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index d3274120f738..d09b9d91cf4f 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -2666,7 +2666,10 @@ again: } snap_rwsem_locked = true; } - *got = need | (have & want); + if ((have & want) == want) + *got = need | want; + else + *got = need; if (S_ISREG(inode->i_mode) && (need & CEPH_CAP_FILE_RD) && !(*got & CEPH_CAP_FILE_CACHE)) |