提交 abb736d4 编写于 作者: J J. Bruce Fields 提交者: Zheng Zengkai

nfsd: fix crash on LOCKT on reexported NFSv3

stable inclusion
from stable-5.10.67
commit eb04c51a439e38dbbab363cf5f0599cbe0507b13
bugzilla: 182619 https://gitee.com/openeuler/kernel/issues/I4EWO7

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=eb04c51a439e38dbbab363cf5f0599cbe0507b13

--------------------------------

[ Upstream commit 0bcc7ca4 ]

Unlike other filesystems, NFSv3 tries to use fl_file in the GETLK case.
Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 8941906f
...@@ -6855,8 +6855,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -6855,8 +6855,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
/* /*
* The NFSv4 spec allows a client to do a LOCKT without holding an OPEN, * The NFSv4 spec allows a client to do a LOCKT without holding an OPEN,
* so we do a temporary open here just to get an open file to pass to * so we do a temporary open here just to get an open file to pass to
* vfs_test_lock. (Arguably perhaps test_lock should be done with an * vfs_test_lock.
* inode operation.)
*/ */
static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock)
{ {
...@@ -6871,7 +6870,9 @@ static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct ...@@ -6871,7 +6870,9 @@ static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct
NFSD_MAY_READ)); NFSD_MAY_READ));
if (err) if (err)
goto out; goto out;
lock->fl_file = nf->nf_file;
err = nfserrno(vfs_test_lock(nf->nf_file, lock)); err = nfserrno(vfs_test_lock(nf->nf_file, lock));
lock->fl_file = NULL;
out: out:
fh_unlock(fhp); fh_unlock(fhp);
nfsd_file_put(nf); nfsd_file_put(nf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册