summaryrefslogtreecommitdiff
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2011-06-10 13:30:23 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-12 13:40:28 -0400
commitd8007d4dd6ff8749cc8a4063c3ec87442db76d82 (patch)
treef778176d24666f2e2c7cd7ef4dc5917aa11cc207 /fs/nfs/write.c
parent1751c3638f2a07a8c66a803a31791bab9bd3fced (diff)
NFSv4.1: Add an initialisation callback for pNFS
Ensure that we always get a layout before setting up the i/o request. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index b144b5474546..d1ae7e45886f 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -916,7 +916,7 @@ static int nfs_flush_multi(struct nfs_pageio_descriptor *desc)
unsigned int offset;
int requests = 0;
int ret = 0;
- struct pnfs_layout_segment *lseg;
+ struct pnfs_layout_segment *lseg = desc->pg_lseg;
LIST_HEAD(list);
nfs_list_remove_request(req);
@@ -940,10 +940,6 @@ static int nfs_flush_multi(struct nfs_pageio_descriptor *desc)
} while (nbytes != 0);
atomic_set(&req->wb_complete, requests);
- BUG_ON(desc->pg_lseg);
- lseg = pnfs_update_layout(desc->pg_inode, req->wb_context,
- req_offset(req), desc->pg_count,
- IOMODE_RW, GFP_NOFS);
ClearPageError(page);
offset = 0;
nbytes = desc->pg_count;
@@ -976,6 +972,8 @@ out_bad:
nfs_writedata_free(data);
}
nfs_redirty_request(req);
+ put_lseg(lseg);
+ desc->pg_lseg = NULL;
return -ENOMEM;
}
@@ -1016,10 +1014,6 @@ static int nfs_flush_one(struct nfs_pageio_descriptor *desc)
*pages++ = req->wb_page;
}
req = nfs_list_entry(data->pages.next);
- if ((!lseg) && list_is_singular(&data->pages))
- lseg = pnfs_update_layout(desc->pg_inode, req->wb_context,
- req_offset(req), desc->pg_count,
- IOMODE_RW, GFP_NOFS);
if ((desc->pg_ioflags & FLUSH_COND_STABLE) &&
(desc->pg_moreio || NFS_I(desc->pg_inode)->ncommit))