Re: [RFC PATCH] ceph: fix cap revoke race

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2019/11/28 10:25, Yan, Zheng wrote:
On 11/27/19 6:45 PM, xiubli@xxxxxxxxxx wrote:
From: Xiubo Li <xiubli@xxxxxxxxxx>

The cap->implemented is one subset of the cap->issued, the logic
here want to exclude the revoking caps, but the following code
will be (~cap->implemented | cap->issued) == 0xFFFF, so it will
make no sense when we doing the "have &= 0xFFFF".

Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx>
---
  fs/ceph/caps.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index c62e88da4fee..a9335402c2a5 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -812,7 +812,7 @@ int __ceph_caps_issued(struct ceph_inode_info *ci, int *implemented)
       */
      if (ci->i_auth_cap) {
          cap = ci->i_auth_cap;
-        have &= ~cap->implemented | cap->issued;
+        have &= ~(cap->implemented & ~cap->issued);

The end result is the same.

See https://en.wikipedia.org/wiki/De_Morgan%27s_laws

Yeah, right, it is.

BRs



      }
      return have;
  }







[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux