Commit 19345cb299e8234006c5125151ab723e851a1d24

Authored by Benny Halevy
Committed by Trond Myklebust
1 parent df18d127f4

NFSv4.1: file layout must consider pg_bsize for coalescing

Otherwise we end up overflowing the rpc buffer size on the receive end.

Signed-off-by: Benny Halevy <benny@tonian.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 3 changed files with 9 additions and 3 deletions Side-by-side Diff

fs/nfs/nfs4filelayout.c
... ... @@ -30,6 +30,7 @@
30 30 */
31 31  
32 32 #include <linux/nfs_fs.h>
  33 +#include <linux/nfs_page.h>
33 34  
34 35 #include "internal.h"
35 36 #include "nfs4filelayout.h"
... ... @@ -666,8 +667,9 @@
666 667 u64 p_stripe, r_stripe;
667 668 u32 stripe_unit;
668 669  
669   - if (!pnfs_generic_pg_test(pgio, prev, req))
670   - return 0;
  670 + if (!pnfs_generic_pg_test(pgio, prev, req) ||
  671 + !nfs_generic_pg_test(pgio, prev, req))
  672 + return false;
671 673  
672 674 if (!pgio->pg_lseg)
673 675 return 1;
... ... @@ -204,7 +204,7 @@
204 204 TASK_UNINTERRUPTIBLE);
205 205 }
206 206  
207   -static bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req)
  207 +bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc, struct nfs_page *prev, struct nfs_page *req)
208 208 {
209 209 /*
210 210 * FIXME: ideally we should be able to coalesce all requests
... ... @@ -218,6 +218,7 @@
218 218  
219 219 return desc->pg_count + req->wb_bytes <= desc->pg_bsize;
220 220 }
  221 +EXPORT_SYMBOL_GPL(nfs_generic_pg_test);
221 222  
222 223 /**
223 224 * nfs_pageio_init - initialise a page io descriptor
include/linux/nfs_page.h
... ... @@ -92,6 +92,9 @@
92 92 struct nfs_page *);
93 93 extern void nfs_pageio_complete(struct nfs_pageio_descriptor *desc);
94 94 extern void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *, pgoff_t);
  95 +extern bool nfs_generic_pg_test(struct nfs_pageio_descriptor *desc,
  96 + struct nfs_page *prev,
  97 + struct nfs_page *req);
95 98 extern int nfs_wait_on_request(struct nfs_page *);
96 99 extern void nfs_unlock_request(struct nfs_page *req);
97 100 extern int nfs_set_page_tag_locked(struct nfs_page *req);