Whamcloud - gitweb
LU-13940 llite: it_lock_bits should be bit-wise tested 97/39797/2
authorShaun Tancheff <shaun.tancheff@hpe.com>
Wed, 2 Sep 2020 14:05:10 +0000 (09:05 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 19 Sep 2020 14:12:20 +0000 (14:12 +0000)
If lock_mode is not set then ensure that it_lock_bits has
the MDS_INODELOCK_OPEN bit set

Fixes: 5db0e2de00 ("LU-7403 llite: flatten struct lookup_intent")
HPE-bug-id: LUS-9198
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: Icccaa59cd5b47a7d3f97569a452f34b33e905409
Reviewed-on: https://review.whamcloud.com/39797
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Petros Koutoupis <petros.koutoupis@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
lustre/llite/file.c

index 927fe8b..9067dfd 100644 (file)
@@ -1158,8 +1158,8 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode,
 
        /* already get lease, handle lease lock */
        ll_set_lock_data(sbi->ll_md_exp, inode, &it, NULL);
-       if (it.it_lock_mode == 0 ||
-           it.it_lock_bits != MDS_INODELOCK_OPEN) {
+       if (!it.it_lock_mode ||
+           !(it.it_lock_bits & MDS_INODELOCK_OPEN)) {
                /* open lock must return for lease */
                CERROR(DFID "lease granted but no open lock, %d/%llu.\n",
                        PFID(ll_inode2fid(inode)), it.it_lock_mode,