diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c index 6f418e0..35e31ad 100644 --- a/fs/lustre/llite/file.c +++ b/fs/lustre/llite/file.c @@ -360,7 +360,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 & 0111) || + !md_lock_match(ll_i2mdexp(inode), flags, ll_inode2fid(inode), LDLM_IBITS, &policy, lockmode, &lockh)) rc = ll_md_real_close(inode, fd->fd_omode);