pnfs: Fix the check for requests in range of layout segment
authorBenjamin Coddington <bcodding@redhat.com>
Tue, 23 May 2017 00:20:23 +0000 (20:20 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 24 May 2017 11:55:02 +0000 (07:55 -0400)
commit08cb5b0f058a325fcb5305e33f572ff6d6dfa289
tree6badaa45f966068d482294770ecab7b5dccfc3e8
parentd2c23c0075d7091bf749411bd2ee757cf4ec356c
pnfs: Fix the check for requests in range of layout segment

It's possible and acceptable for NFS to attempt to add requests beyond the
range of the current pgio->pg_lseg, a case which should be caught and
limited by the pg_test operation.  However, the current handling of this
case replaces pgio->pg_lseg with a new layout segment (after a WARN) within
that pg_test operation.  That will cause all the previously added requests
to be submitted with this new layout segment, which may not be valid for
those requests.

Fix this problem by only returning zero for the number of bytes to coalesce
from pg_test for this case which allows any previously added requests to
complete on the current layout segment.  The check for requests starting
out of range of the layout segment moves to pg_init, so that the
replacement of pgio->pg_lseg will be done when the next request is added.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/pnfs.c
fs/nfs/pnfs.h