From afa629e742b0ee251ed87f33d5f66bc378f63bef Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mar 25 2024 02:26:48 +0000 Subject: NFS: Fix O_DIRECT locking issues (git-fixes). --- diff --git a/patches.suse/NFS-Fix-O_DIRECT-locking-issues.patch b/patches.suse/NFS-Fix-O_DIRECT-locking-issues.patch new file mode 100644 index 0000000..7a98c8a --- /dev/null +++ b/patches.suse/NFS-Fix-O_DIRECT-locking-issues.patch @@ -0,0 +1,50 @@ +From: Trond Myklebust +Date: Mon, 4 Sep 2023 12:34:38 -0400 +Subject: [PATCH] NFS: Fix O_DIRECT locking issues +Git-commit: 7c6339322ce0c6128acbe36aacc1eeb986dd7bf1 +Patch-mainline: v6.6 +References: git-fixes + +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 +Signed-off-by: Anna Schumaker +Acked-by: NeilBrown + +--- + fs/nfs/direct.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/fs/nfs/direct.c ++++ b/fs/nfs/direct.c +@@ -589,7 +589,7 @@ static void nfs_direct_write_reschedule( + while (!list_empty(&reqs)) { + req = nfs_list_entry(reqs.next); + 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) { +@@ -599,7 +599,7 @@ static void nfs_direct_write_reschedule( + 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); +@@ -906,9 +906,9 @@ static ssize_t nfs_direct_write_schedule + + /* 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; diff --git a/series.conf b/series.conf index 30c91d9..cb1269a 100644 --- a/series.conf +++ b/series.conf @@ -64838,6 +64838,7 @@ patches.suse/scsi-qla2xxx-Use-raw_smp_processor_id-instead-of-smp.patch patches.suse/scsi-qla2xxx-Fix-NULL-vs-IS_ERR-bug-for-debugfs_crea.patch patches.suse/NFS-Fix-error-handling-for-O_DIRECT-write-scheduling.patch + patches.suse/NFS-Fix-O_DIRECT-locking-issues.patch patches.suse/NFS-More-O_DIRECT-accounting-fixes-for-error-paths.patch patches.suse/NFS-pNFS-Report-EINVAL-errors-from-connect-to-the-se.patch patches.suse/ipv4-fix-null-deref-in-ipv4_link_failure.patch