summaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2023-09-04 18:34:38 +0200
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2023-09-13 17:50:57 +0200
commit7c6339322ce0c6128acbe36aacc1eeb986dd7bf1 (patch)
tree7b2d44b717f324b7b08cd2bbdefe19eea02930e1 /fs/nfs/direct.c
parentNFS: Fix error handling for O_DIRECT write scheduling (diff)
downloadlinux-7c6339322ce0c6128acbe36aacc1eeb986dd7bf1.tar.xz
linux-7c6339322ce0c6128acbe36aacc1eeb986dd7bf1.zip
NFS: Fix O_DIRECT locking issues
The dreq fields are protected by the dreq->lock. Fixes: 954998b60caa ("NFS: Fix error handling for O_DIRECT write scheduling") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index ee88f0a6e7b8..e8a1645857dd 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -553,7 +553,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
/* Bump the transmission count */
req->wb_nio++;
if (!nfs_pageio_add_request(&desc, req)) {
- spin_lock(&cinfo.inode->i_lock);
+ spin_lock(&dreq->lock);
if (dreq->error < 0) {
desc.pg_error = dreq->error;
} else if (desc.pg_error != -EAGAIN) {
@@ -563,7 +563,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
dreq->error = desc.pg_error;
} else
dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
- spin_unlock(&cinfo.inode->i_lock);
+ spin_unlock(&dreq->lock);
break;
}
nfs_release_request(req);
@@ -871,9 +871,9 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq,
/* If the error is soft, defer remaining requests */
nfs_init_cinfo_from_dreq(&cinfo, dreq);
- spin_lock(&cinfo.inode->i_lock);
+ spin_lock(&dreq->lock);
dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
- spin_unlock(&cinfo.inode->i_lock);
+ spin_unlock(&dreq->lock);
nfs_unlock_request(req);
nfs_mark_request_commit(req, NULL, &cinfo, 0);
desc.pg_error = 0;