[pnfs] [PATCH 1/1] pnfsd: layoutcommit set size fix
Benny Halevy
bhalevy at panasas.com
Wed Mar 5 01:56:49 EST 2008
On Mar. 05, 2008, 2:01 +0200, Ricardo Labiaga <ricardo.labiaga at netapp.com> wrote:
> From: Ricardo Labiaga <Ricardo.Labiaga at netapp.com>
>
> nfsd4_layoutcommit() should only reset the size of the file if
> the client modified the file size. The client indicates size change
> by setting the no_newoffset field in the LAYOUT_COMMIT message.
>
> Note that the 'no_' prefix stands for "new offset", not for negative.
> If no_newoffset is false while XDR decoding (no file change), we set
> lcp->lc_newoffset to zero to indicate this.
>
> Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga at netapp.com>
> ---
> fs/nfsd/nfs4proc.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index be017b2..5839c57 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -1098,7 +1098,8 @@ nfsd4_layoutcommit(struct svc_rqst *rqstp,
> __FUNCTION__, lcp->lc_last_wr + 1, ino->i_size);
Ricardo, how about also updating the debug message and comment
right above? (reminder: please also s/__FUNCTION__/__func__/ :)
Benny
>
> fh_lock(current_fh);
> - if ((lcp->lc_last_wr + 1) <= ino->i_size) {
> + if ((lcp->lc_newoffset == 0) ||
> + ((lcp->lc_last_wr + 1) <= ino->i_size)) {
> status = 0;
> lcp->lc_size_chg = 0;
> fh_unlock(current_fh);
More information about the pNFS
mailing list