diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-06-10 13:30:23 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-07-12 13:40:28 -0400 |
commit | d8007d4dd6ff8749cc8a4063c3ec87442db76d82 (patch) | |
tree | f778176d24666f2e2c7cd7ef4dc5917aa11cc207 /fs/nfs/write.c | |
parent | 1751c3638f2a07a8c66a803a31791bab9bd3fced (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.c | 12 |
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) | |||
916 | unsigned int offset; | 916 | unsigned int offset; |
917 | int requests = 0; | 917 | int requests = 0; |
918 | int ret = 0; | 918 | int ret = 0; |
919 | struct pnfs_layout_segment *lseg; | 919 | struct pnfs_layout_segment *lseg = desc->pg_lseg; |
920 | LIST_HEAD(list); | 920 | LIST_HEAD(list); |
921 | 921 | ||
922 | nfs_list_remove_request(req); | 922 | nfs_list_remove_request(req); |
@@ -940,10 +940,6 @@ static int nfs_flush_multi(struct nfs_pageio_descriptor *desc) | |||
940 | } while (nbytes != 0); | 940 | } while (nbytes != 0); |
941 | atomic_set(&req->wb_complete, requests); | 941 | atomic_set(&req->wb_complete, requests); |
942 | 942 | ||
943 | BUG_ON(desc->pg_lseg); | ||
944 | lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, | ||
945 | req_offset(req), desc->pg_count, | ||
946 | IOMODE_RW, GFP_NOFS); | ||
947 | ClearPageError(page); | 943 | ClearPageError(page); |
948 | offset = 0; | 944 | offset = 0; |
949 | nbytes = desc->pg_count; | 945 | nbytes = desc->pg_count; |
@@ -976,6 +972,8 @@ out_bad: | |||
976 | nfs_writedata_free(data); | 972 | nfs_writedata_free(data); |
977 | } | 973 | } |
978 | nfs_redirty_request(req); | 974 | nfs_redirty_request(req); |
975 | put_lseg(lseg); | ||
976 | desc->pg_lseg = NULL; | ||
979 | return -ENOMEM; | 977 | return -ENOMEM; |
980 | } | 978 | } |
981 | 979 | ||
@@ -1016,10 +1014,6 @@ static int nfs_flush_one(struct nfs_pageio_descriptor *desc) | |||
1016 | *pages++ = req->wb_page; | 1014 | *pages++ = req->wb_page; |
1017 | } | 1015 | } |
1018 | req = nfs_list_entry(data->pages.next); | 1016 | req = nfs_list_entry(data->pages.next); |
1019 | if ((!lseg) && list_is_singular(&data->pages)) | ||
1020 | lseg = pnfs_update_layout(desc->pg_inode, req->wb_context, | ||
1021 | req_offset(req), desc->pg_count, | ||
1022 | IOMODE_RW, GFP_NOFS); | ||
1023 | 1017 | ||
1024 | if ((desc->pg_ioflags & FLUSH_COND_STABLE) && | 1018 | if ((desc->pg_ioflags & FLUSH_COND_STABLE) && |
1025 | (desc->pg_moreio || NFS_I(desc->pg_inode)->ncommit)) | 1019 | (desc->pg_moreio || NFS_I(desc->pg_inode)->ncommit)) |