aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2011-10-18 13:11:07 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-09 11:52:46 -0500
commitee6dfa64be0c1e8976f20246278121bc9fcf1a24 (patch)
tree601602d7d7ea56cb952a3401ca69fd97639ac111 /fs/nfs
parent0198f84095f61e3ae0643eddb76df9ac684dae43 (diff)
NFS: Prevent 3.0 from crashing if it receives a partial layout
This is a backport of critical parts of commit 7c24d9489f "NFSv4.1: File layout only supports whole file layouts" It prevents the file layout driver from (incorrectly) using partial layouts, but ignores the part of the referenced commmit that relies on additional machinery to change the LAYOUTGET request based on layout driver. Signed-off-by: Fred Isaman <iisaman@netapp.com> Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4filelayout.c8
-rw-r--r--fs/nfs/pnfs.c3
2 files changed, 10 insertions, 1 deletions
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 614c4d287d7..75af81211e4 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -428,6 +428,14 @@ filelayout_check_layout(struct pnfs_layout_hdr *lo,
428 428
429 dprintk("--> %s\n", __func__); 429 dprintk("--> %s\n", __func__);
430 430
431 /* FIXME: remove this check when layout segment support is added */
432 if (lgr->range.offset != 0 ||
433 lgr->range.length != NFS4_MAX_UINT64) {
434 dprintk("%s Only whole file layouts supported. Use MDS i/o\n",
435 __func__);
436 goto out;
437 }
438
431 if (fl->pattern_offset > lgr->range.offset) { 439 if (fl->pattern_offset > lgr->range.offset) {
432 dprintk("%s pattern_offset %lld too large\n", 440 dprintk("%s pattern_offset %lld too large\n",
433 __func__, fl->pattern_offset); 441 __func__, fl->pattern_offset);
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index a726c0afa76..36d2a29bfbe 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -980,7 +980,8 @@ pnfs_update_layout(struct inode *ino,
980 arg.offset -= pg_offset; 980 arg.offset -= pg_offset;
981 arg.length += pg_offset; 981 arg.length += pg_offset;
982 } 982 }
983 arg.length = PAGE_CACHE_ALIGN(arg.length); 983 if (arg.length != NFS4_MAX_UINT64)
984 arg.length = PAGE_CACHE_ALIGN(arg.length);
984 985
985 lseg = send_layoutget(lo, ctx, &arg, gfp_flags); 986 lseg = send_layoutget(lo, ctx, &arg, gfp_flags);
986 if (!lseg && first) { 987 if (!lseg && first) {