Skip to content

Commit b11243f

Browse files
Trond Myklebustamschuma-ntap
authored andcommitted
NFS: More fixes for nfs_direct_write_reschedule_io()
Ensure that all requests are put back onto the commit list so that they can be rescheduled. Fixes: 4daaeba ("NFS: Fix nfs_direct_write_reschedule_io()") Signed-off-by: Trond Myklebust <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent b193a78 commit b11243f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

fs/nfs/direct.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -780,18 +780,23 @@ static void nfs_write_sync_pgio_error(struct list_head *head, int error)
780780
static void nfs_direct_write_reschedule_io(struct nfs_pgio_header *hdr)
781781
{
782782
struct nfs_direct_req *dreq = hdr->dreq;
783+
struct nfs_page *req;
784+
struct nfs_commit_info cinfo;
783785

784786
trace_nfs_direct_write_reschedule_io(dreq);
785787

788+
nfs_init_cinfo_from_dreq(&cinfo, dreq);
786789
spin_lock(&dreq->lock);
787-
if (dreq->error == 0) {
790+
if (dreq->error == 0)
788791
dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
789-
/* fake unstable write to let common nfs resend pages */
790-
hdr->verf.committed = NFS_UNSTABLE;
791-
hdr->good_bytes = hdr->args.offset + hdr->args.count -
792-
hdr->io_start;
793-
}
792+
set_bit(NFS_IOHDR_REDO, &hdr->flags);
794793
spin_unlock(&dreq->lock);
794+
while (!list_empty(&hdr->pages)) {
795+
req = nfs_list_entry(hdr->pages.next);
796+
nfs_list_remove_request(req);
797+
nfs_unlock_request(req);
798+
nfs_mark_request_commit(req, NULL, &cinfo, 0);
799+
}
795800
}
796801

797802
static const struct nfs_pgio_completion_ops nfs_direct_write_completion_ops = {

0 commit comments

Comments
 (0)