aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
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-06-21 11:54:06 -0400
commit19982ba8562e33083cb5bbb59a74855d8a9624ea (patch)
tree51656f4ff6252a0207a0f42feea147c736474171 /fs/nfs
parent8f7d5efbef8718a774ac5e347b4ec069f17fd9b4 (diff)
NFSv4.1: Fix an off-by-one error in pnfs_generic_pg_test
And document what is going on there... Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/pnfs.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 0f42e02436ee..29c0ca7fc347 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1078,11 +1078,22 @@ pnfs_generic_pg_test(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
1078 return true; 1078 return true;
1079 } 1079 }
1080 1080
1081 if (req_offset(req) > end_offset(pgio->pg_lseg->pls_range.offset, 1081 /*
1082 pgio->pg_lseg->pls_range.length)) 1082 * Test if a nfs_page is fully contained in the pnfs_layout_range.
1083 return false; 1083 * Note that this test makes several assumptions:
1084 1084 * - that the previous nfs_page in the struct nfs_pageio_descriptor
1085 return true; 1085 * is known to lie within the range.
1086 * - that the nfs_page being tested is known to be contiguous with the
1087 * previous nfs_page.
1088 * - Layout ranges are page aligned, so we only have to test the
1089 * start offset of the request.
1090 *
1091 * Please also note that 'end_offset' is actually the offset of the
1092 * first byte that lies outside the pnfs_layout_range. FIXME?
1093 *
1094 */
1095 return req_offset(req) < end_offset(pgio->pg_lseg->pls_range.offset,
1096 pgio->pg_lseg->pls_range.length);
1086} 1097}
1087EXPORT_SYMBOL_GPL(pnfs_generic_pg_test); 1098EXPORT_SYMBOL_GPL(pnfs_generic_pg_test);
1088 1099