summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server
diff options
context:
space:
mode:
authorMichael Brown <michael@netdirect.ca>2013-04-26 15:32:03 -0400
committerAnand Avati <avati@redhat.com>2013-05-07 21:48:36 -0700
commitd4557824a64e1eb5aa2ee5dece237a5e9bb8eac8 (patch)
tree00b6db02c4d27c5adda38bd3c1715ff1805dcf5f /xlators/nfs/server
parentb5bf14a6ab0d24073d0dd4debf87c7fc15a1e43f (diff)
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 <michael@netdirect.ca> Reviewed-on: http://review.gluster.org/4917 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/nfs/server')
-rw-r--r--xlators/nfs/server/src/nfs3.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 3ecd9749826..9b756712b74 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);