NFSv2: EOF incorrectly set on short read
authorSachin Prabhu <sprabhu@redhat.com>
Thu, 31 May 2012 16:45:00 +0000 (17:45 +0100)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 11 Jun 2012 21:25:00 +0000 (17:25 -0400)
In cases where the server returns fewer bytes then those requested, we
can incorrectly set the eof flag for the file. Fixing this allows the
request to be retried with updated offset and count arguments.

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/proc.c

index a706b6b..617c741 100644 (file)
@@ -651,7 +651,7 @@ static int nfs_read_done(struct rpc_task *task, struct nfs_read_data *data)
                /* Emulate the eof flag, which isn't normally needed in NFSv2
                 * as it is guaranteed to always return the file attributes
                 */
-               if (data->args.offset + data->args.count >= data->res.fattr->size)
+               if (data->args.offset + data->res.count >= data->res.fattr->size)
                        data->res.eof = 1;
        }
        return 0;