From d4557824a64e1eb5aa2ee5dece237a5e9bb8eac8 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Fri, 26 Apr 2013 15:32:03 -0400 Subject: nfs3-server: call truncate fop only if necessary * nfs3svc_setattr_cbk: only truncate if requested size != current size Change-Id: I3d89e4d2b0710118f90cf5bf9cfdea61d8877491 BUG: 960725 Signed-off-by: Michael Brown Reviewed-on: http://review.gluster.org/4917 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/nfs/server/src/nfs3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xlators/nfs') diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c index 3ecd97498..9b756712b 100644 --- a/xlators/nfs/server/src/nfs3.c +++ b/xlators/nfs/server/src/nfs3.c @@ -971,7 +971,8 @@ nfs3svc_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * truncation and also only if this is not a directory. */ if ((gf_attr_size_set (cs->setattr_valid)) && - (!IA_ISDIR (postop->ia_type))) { + (!IA_ISDIR (postop->ia_type)) && + (preop->ia_size != cs->stbuf.ia_size)) { nfs_request_user_init (&nfu, cs->req); ret = nfs_truncate (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc, cs->stbuf.ia_size, nfs3svc_truncate_cbk,cs); -- cgit