Whamcloud - gitweb
LU-4398 llite: do not cache write open lock for exec file 65/32265/9
authorJinshan Xiong <jinshan.xiong@uber.com>
Tue, 1 May 2018 18:35:53 +0000 (11:35 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Jul 2019 06:13:54 +0000 (06:13 +0000)
This is to avoid the problem that the MDT needs an extra lock
revocation to make the file be able to execute.

Signed-off-by: Jinshan Xiong <jinshan.xiong@uber.com>
Signed-off-by: Gu Zheng <gzheng@ddn.com>
Change-Id: Ibb42a9a8cb56a9bf48a6e972b72d3d71ed7fbaf5
Reviewed-on: https://review.whamcloud.com/32265
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/file.c
lustre/tests/sanity.sh

index 16e0ea2..dad39ac 100644 (file)
@@ -353,7 +353,9 @@ static int ll_md_close(struct inode *inode, struct file *file)
        }
        mutex_unlock(&lli->lli_och_mutex);
 
-       if (!md_lock_match(ll_i2mdexp(inode), flags, ll_inode2fid(inode),
+       /* LU-4398: do not cache write open lock if the file has exec bit */
+       if ((lockmode == LCK_CW && inode->i_mode & S_IXUGO) ||
+           !md_lock_match(ll_i2mdexp(inode), flags, ll_inode2fid(inode),
                           LDLM_IBITS, &policy, lockmode, &lockh))
                rc = ll_md_real_close(inode, fd->fd_omode);
 
index 974b52d..59f1210 100644 (file)
@@ -53,8 +53,8 @@ fi
 if [[ $(uname -m) = aarch64 ]]; then
        # bug number:    LU-11596
        ALWAYS_EXCEPT+=" $GRANT_CHECK_LIST"
-       # bug number:    LU-11671 LU-11594 LU-11667 LU-11729
-       ALWAYS_EXCEPT+=" 45       103a      317      810"
+       # bug number:    LU-11671 LU-11594 LU-11667 LU-11729 LU-4398
+       ALWAYS_EXCEPT+=" 45       103a      317      810       817"
 fi
 
 #                                  5          12          (min)"
@@ -21656,6 +21656,30 @@ test_816() {
 }
 run_test 816 "do not reset lru_resize on idle reconnect"
 
+cleanup_817() {
+       umount $tmpdir
+       exportfs -u localhost:$DIR/nfsexp
+       rm -rf $DIR/nfsexp
+}
+
+test_817() {
+       systemctl restart nfs-server.service || skip "failed to restart nfsd"
+
+       mkdir -p $DIR/nfsexp
+       exportfs -orw,no_root_squash localhost:$DIR/nfsexp ||
+               error "failed to export nfs"
+
+       tmpdir=$(mktemp -d /tmp/nfs-XXXXXX)
+       stack_trap cleanup_817 EXIT
+
+       mount -t nfs -orw localhost:$DIR/nfsexp $tmpdir ||
+               error "failed to mount nfs to $tmpdir"
+
+       cp /bin/true $tmpdir
+       $DIR/nfsexp/true || error "failed to execute 'true' command"
+}
+run_test 817 "nfsd won't cache write lock for exec file"
+
 #
 # tests that do cleanup/setup should be run at the end
 #