From: Jinshan Xiong Date: Tue, 1 May 2018 18:35:53 +0000 (-0700) Subject: LU-4398 llite: do not cache write open lock for exec file X-Git-Tag: 2.12.57~75 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=6dd9d57bc006a37731d34409ce43de13c192e0cc;p=fs%2Flustre-release.git LU-4398 llite: do not cache write open lock for exec file 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 Signed-off-by: Gu Zheng Change-Id: Ibb42a9a8cb56a9bf48a6e972b72d3d71ed7fbaf5 Reviewed-on: https://review.whamcloud.com/32265 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 16e0ea2..dad39ac 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 974b52d..59f1210 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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 #