msg.rpc_cred = nfs_cred(inode, filp);
status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
- if (status >= 0)
+ if (status >= 0) {
nfs_refresh_inode(inode, fattr);
+ /* Emulate the eof flag, which isn't normally needed in NFSv2
+ * as it is guaranteed to always return the file attributes
+ */
+ if (rdata->args.offset + rdata->args.count >= fattr->size)
+ rdata->res.eof = 1;
+ }
dprintk("NFS reply read: %d\n", status);
return status;
}
{
struct nfs_read_data *data = (struct nfs_read_data *) task->tk_calldata;
- if (task->tk_status >= 0)
+ if (task->tk_status >= 0) {
nfs_refresh_inode(data->inode, data->res.fattr);
+ /* 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)
+ data->res.eof = 1;
+ }
nfs_readpage_result(task);
}
}
count -= result;
rdata.args.pgbase += result;
- if (result < rdata.args.count) /* NFSv2ism */
+ /* Note: result == 0 should only happen if we're caching
+ * a write that extends the file and punches a hole.
+ */
+ if (rdata.res.eof != 0 || result == 0)
break;
} while (count);
NFS_FLAGS(inode) |= NFS_INO_INVALID_ATIME;