Linux NFS development
 help / color / mirror / Atom feed
From: trondmy@kernel.org
To: Anna Schumaker <anna.schumaker@netapp.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH v2 5/5] NFS: More fixes for nfs_direct_write_reschedule_io()
Date: Mon,  4 Sep 2023 12:34:41 -0400	[thread overview]
Message-ID: <20230904163441.11950-6-trondmy@kernel.org> (raw)
In-Reply-To: <20230904163441.11950-5-trondmy@kernel.org>

From: Trond Myklebust <trond.myklebust@hammerspace.com>

Ensure that all requests are put back onto the commit list so that they
can be rescheduled.

Fixes: 4daaeba93822 ("NFS: Fix nfs_direct_write_reschedule_io()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/direct.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 3391c8b97da5..f6c74f424691 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -780,18 +780,23 @@ static void nfs_write_sync_pgio_error(struct list_head *head, int error)
 static void nfs_direct_write_reschedule_io(struct nfs_pgio_header *hdr)
 {
 	struct nfs_direct_req *dreq = hdr->dreq;
+	struct nfs_page *req;
+	struct nfs_commit_info cinfo;
 
 	trace_nfs_direct_write_reschedule_io(dreq);
 
+	nfs_init_cinfo_from_dreq(&cinfo, dreq);
 	spin_lock(&dreq->lock);
-	if (dreq->error == 0) {
+	if (dreq->error == 0)
 		dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
-		/* fake unstable write to let common nfs resend pages */
-		hdr->verf.committed = NFS_UNSTABLE;
-		hdr->good_bytes = hdr->args.offset + hdr->args.count -
-			hdr->io_start;
-	}
+	set_bit(NFS_IOHDR_REDO, &hdr->flags);
 	spin_unlock(&dreq->lock);
+	while (!list_empty(&hdr->pages)) {
+		req = nfs_list_entry(hdr->pages.next);
+		nfs_list_remove_request(req);
+		nfs_unlock_request(req);
+		nfs_mark_request_commit(req, NULL, &cinfo, 0);
+	}
 }
 
 static const struct nfs_pgio_completion_ops nfs_direct_write_completion_ops = {
-- 
2.41.0


  reply	other threads:[~2023-09-04 16:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04 16:34 [PATCH v2 0/5] Fix O_DIRECT writeback error paths trondmy
2023-09-04 16:34 ` [PATCH v2 1/5] NFS: Fix error handling for O_DIRECT write scheduling trondmy
2023-09-04 16:34   ` [PATCH v2 2/5] NFS: Fix O_DIRECT locking issues trondmy
2023-09-04 16:34     ` [PATCH v2 3/5] NFS: More O_DIRECT accounting fixes for error paths trondmy
2023-09-04 16:34       ` [PATCH v2 4/5] NFS: Use the correct commit info in nfs_join_page_group() trondmy
2023-09-04 16:34         ` trondmy [this message]
2023-11-09 15:05   ` [PATCH v2 1/5] NFS: Fix error handling for O_DIRECT write scheduling Benjamin Coddington
2023-11-09 16:53     ` Trond Myklebust
2023-11-09 17:25       ` Benjamin Coddington
2023-11-15 13:04         ` Benjamin Coddington
2023-11-15 17:16           ` Trond Myklebust
2023-11-15 21:30             ` Benjamin Coddington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230904163441.11950-6-trondmy@kernel.org \
    --to=trondmy@kernel.org \
    --cc=anna.schumaker@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox