aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 9f81bdd91c55..4c14c17a5276 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -55,7 +55,6 @@ struct nfs_write_data *nfs_commitdata_alloc(void)
55 if (p) { 55 if (p) {
56 memset(p, 0, sizeof(*p)); 56 memset(p, 0, sizeof(*p));
57 INIT_LIST_HEAD(&p->pages); 57 INIT_LIST_HEAD(&p->pages);
58 p->res.seq_res.sr_slotid = NFS4_MAX_SLOT_TABLE;
59 } 58 }
60 return p; 59 return p;
61} 60}
@@ -75,7 +74,6 @@ struct nfs_write_data *nfs_writedata_alloc(unsigned int pagecount)
75 memset(p, 0, sizeof(*p)); 74 memset(p, 0, sizeof(*p));
76 INIT_LIST_HEAD(&p->pages); 75 INIT_LIST_HEAD(&p->pages);
77 p->npages = pagecount; 76 p->npages = pagecount;
78 p->res.seq_res.sr_slotid = NFS4_MAX_SLOT_TABLE;
79 if (pagecount <= ARRAY_SIZE(p->page_array)) 77 if (pagecount <= ARRAY_SIZE(p->page_array))
80 p->pagevec = p->page_array; 78 p->pagevec = p->page_array;
81 else { 79 else {
@@ -292,9 +290,7 @@ static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, st
292 nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1); 290 nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);
293 291
294 nfs_pageio_cond_complete(pgio, page->index); 292 nfs_pageio_cond_complete(pgio, page->index);
295 ret = nfs_page_async_flush(pgio, page, 293 ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE);
296 wbc->sync_mode == WB_SYNC_NONE ||
297 wbc->nonblocking != 0);
298 if (ret == -EAGAIN) { 294 if (ret == -EAGAIN) {
299 redirty_page_for_writepage(wbc, page); 295 redirty_page_for_writepage(wbc, page);
300 ret = 0; 296 ret = 0;
@@ -700,7 +696,9 @@ int nfs_flush_incompatible(struct file *file, struct page *page)
700 req = nfs_page_find_request(page); 696 req = nfs_page_find_request(page);
701 if (req == NULL) 697 if (req == NULL)
702 return 0; 698 return 0;
703 do_flush = req->wb_page != page || req->wb_context != ctx; 699 do_flush = req->wb_page != page || req->wb_context != ctx ||
700 req->wb_lock_context->lockowner != current->files ||
701 req->wb_lock_context->pid != current->tgid;
704 nfs_release_request(req); 702 nfs_release_request(req);
705 if (!do_flush) 703 if (!do_flush)
706 return 0; 704 return 0;
@@ -824,6 +822,7 @@ static int nfs_write_rpcsetup(struct nfs_page *req,
824 data->args.pages = data->pagevec; 822 data->args.pages = data->pagevec;
825 data->args.count = count; 823 data->args.count = count;
826 data->args.context = get_nfs_open_context(req->wb_context); 824 data->args.context = get_nfs_open_context(req->wb_context);
825 data->args.lock_context = req->wb_lock_context;
827 data->args.stable = NFS_UNSTABLE; 826 data->args.stable = NFS_UNSTABLE;
828 if (how & FLUSH_STABLE) { 827 if (how & FLUSH_STABLE) {
829 data->args.stable = NFS_DATA_SYNC; 828 data->args.stable = NFS_DATA_SYNC;
@@ -1047,9 +1046,9 @@ out:
1047void nfs_write_prepare(struct rpc_task *task, void *calldata) 1046void nfs_write_prepare(struct rpc_task *task, void *calldata)
1048{ 1047{
1049 struct nfs_write_data *data = calldata; 1048 struct nfs_write_data *data = calldata;
1050 struct nfs_client *clp = (NFS_SERVER(data->inode))->nfs_client;
1051 1049
1052 if (nfs4_setup_sequence(clp, &data->args.seq_args, 1050 if (nfs4_setup_sequence(NFS_SERVER(data->inode),
1051 &data->args.seq_args,
1053 &data->res.seq_res, 1, task)) 1052 &data->res.seq_res, 1, task))
1054 return; 1053 return;
1055 rpc_call_start(task); 1054 rpc_call_start(task);
@@ -1430,15 +1429,17 @@ static int nfs_commit_unstable_pages(struct inode *inode, struct writeback_contr
1430 int flags = FLUSH_SYNC; 1429 int flags = FLUSH_SYNC;
1431 int ret = 0; 1430 int ret = 0;
1432 1431
1433 /* Don't commit yet if this is a non-blocking flush and there are 1432 if (wbc->sync_mode == WB_SYNC_NONE) {
1434 * lots of outstanding writes for this mapping. 1433 /* Don't commit yet if this is a non-blocking flush and there
1435 */ 1434 * are a lot of outstanding writes for this mapping.
1436 if (wbc->sync_mode == WB_SYNC_NONE && 1435 */
1437 nfsi->ncommit <= (nfsi->npages >> 1)) 1436 if (nfsi->ncommit <= (nfsi->npages >> 1))
1438 goto out_mark_dirty; 1437 goto out_mark_dirty;
1439 1438
1440 if (wbc->nonblocking || wbc->for_background) 1439 /* don't wait for the COMMIT response */
1441 flags = 0; 1440 flags = 0;
1441 }
1442
1442 ret = nfs_commit_inode(inode, flags); 1443 ret = nfs_commit_inode(inode, flags);
1443 if (ret >= 0) { 1444 if (ret >= 0) {
1444 if (wbc->sync_mode == WB_SYNC_NONE) { 1445 if (wbc->sync_mode == WB_SYNC_NONE) {