NFS: Ensure we set NFS_CONTEXT_RESEND_WRITES when requeuing writes
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 17 Jun 2015 23:56:22 +0000 (19:56 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 18 Jun 2015 00:00:42 +0000 (20:00 -0400)
If a write attempt fails, and the write is queued up for resending to
the server, as opposed to being dropped, then we need to set the
appropriate flag so that nfs_file_fsync() does the right thing.

Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/pnfs.c
fs/nfs/write.c

index 219ee6a3f1b3d5d4b5058e9df58fd887c7013c42..d47c188682b163b15e72dd933deb96ba6540b72f 100644 (file)
@@ -1821,6 +1821,7 @@ int pnfs_write_done_resend_to_mds(struct nfs_pgio_header *hdr)
        /* Resend all requests through the MDS */
        nfs_pageio_init_write(&pgio, hdr->inode, FLUSH_STABLE, true,
                              hdr->completion_ops);
+       set_bit(NFS_CONTEXT_RESEND_WRITES, &hdr->args.context->flags);
        return nfs_pageio_resend(&pgio, hdr);
 }
 EXPORT_SYMBOL_GPL(pnfs_write_done_resend_to_mds);
index dfc19f1575a19d00bee1b0aeef6575e4416a9ef9..daf35564284589d23ce3bd4f74e19fe381fef663 100644 (file)
@@ -1289,6 +1289,7 @@ static void nfs_initiate_write(struct nfs_pgio_header *hdr,
 static void nfs_redirty_request(struct nfs_page *req)
 {
        nfs_mark_request_dirty(req);
+       set_bit(NFS_CONTEXT_RESEND_WRITES, &req->wb_context->flags);
        nfs_unlock_request(req);
        nfs_end_page_writeback(req);
        nfs_release_request(req);