Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 4daaeba93822 ("NFS: Fix nfs_direct_write_reschedule_io()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>

authored by

Trond Myklebust and committed by
Anna Schumaker
b11243f7 b193a78d

+11 -6
+11 -6
fs/nfs/direct.c
··· 780 780 static void nfs_direct_write_reschedule_io(struct nfs_pgio_header *hdr) 781 781 { 782 782 struct nfs_direct_req *dreq = hdr->dreq; 783 + struct nfs_page *req; 784 + struct nfs_commit_info cinfo; 783 785 784 786 trace_nfs_direct_write_reschedule_io(dreq); 785 787 788 + nfs_init_cinfo_from_dreq(&cinfo, dreq); 786 789 spin_lock(&dreq->lock); 787 - if (dreq->error == 0) { 790 + if (dreq->error == 0) 788 791 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); 794 793 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 + } 795 800 } 796 801 797 802 static const struct nfs_pgio_completion_ops nfs_direct_write_completion_ops = {