From: Yan, Zheng Date: Tue, 18 Feb 2020 13:17:08 +0000 (-0500) Subject: ceph: don't take refs to want mask unless we have all bits X-Git-Tag: v5.7-rc1~39^2~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=173e70e8ac0f1e7e3eb98f1ffb953e80a5cc8a5f;p=thirdparty%2Fkernel%2Flinux.git 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" Reviewed-by: Jeff Layton Signed-off-by: Ilya Dryomov --- diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index d3274120f7383..d09b9d91cf4f5 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))