From be312da5eac94410c41dac5dc1dde810974a12b7 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Sat, 19 Mar 2016 11:40:26 +0530 Subject: cluster/afr: Don't let NFS cache stat after writes Problem: Afr does post-ops after write but the stat buffer it unwinds is at the time of write, so if nfs client caches this, it will see different ctime when it does stat on it after post-op is done. From NFS client's perspective it thinks the file is changed. Tar which depends on this to be correct keeps giving 'file changed as we read it' warning. If Afr instead has to choose to unwind after post-op, eager-lock, delayed-post-op will have to be disabled which will lead to bad performance for all write usecases. Fix: Don't let client cache stat after write. >Change-Id: Ic6062acc6e5cdd97a9c83c56bd529ec83cee8a23 >BUG: 1302948 >Signed-off-by: Pranith Kumar K >Signed-off-by: Anuradha Talur >Reviewed-on: http://review.gluster.org/13785 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Reviewed-by: Niels de Vos BUG: 1335285 Change-Id: Ibef4fc80496d12acd15db57713af2e3a1c9109a7 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/14300 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Ravishankar N Reviewed-by: Niels de Vos --- xlators/nfs/server/src/nfs-common.c | 19 ------------------- xlators/nfs/server/src/nfs-common.h | 3 --- xlators/nfs/server/src/nfs3-helpers.c | 4 ++-- 3 files changed, 2 insertions(+), 24 deletions(-) (limited to 'xlators/nfs/server/src') diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c index 51a2b7e36f7..d9ea1e1ac47 100644 --- a/xlators/nfs/server/src/nfs-common.c +++ b/xlators/nfs/server/src/nfs-common.c @@ -106,25 +106,6 @@ nfs_mntpath_to_xlator (xlator_list_t *cl, char *path) } -/* Returns 1 if the stat seems to be filled with zeroes. */ -int -nfs_zero_filled_stat (struct iatt *buf) -{ - if (!buf) - return 1; - - /* Do not use st_dev because it is transformed to store the xlator id - * in place of the device number. Do not use st_ino because by this time - * we've already mapped the root ino to 1 so it is not guaranteed to be - * 0. - */ - if ((buf->ia_nlink == 0) && (buf->ia_ctime == 0)) - return 1; - - return 0; -} - - void nfs_loc_wipe (loc_t *loc) { diff --git a/xlators/nfs/server/src/nfs-common.h b/xlators/nfs/server/src/nfs-common.h index fa7f4ebf212..77bdfb0bbf0 100644 --- a/xlators/nfs/server/src/nfs-common.h +++ b/xlators/nfs/server/src/nfs-common.h @@ -37,9 +37,6 @@ nfs_path_to_xlator (xlator_list_t *cl, char *path); extern xlator_t * nfs_mntpath_to_xlator (xlator_list_t *cl, char *path); -extern int -nfs_zero_filled_stat (struct iatt *buf); - extern void nfs_loc_wipe (loc_t *loc); diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c index 7eb491142f7..ad4c87e69d7 100644 --- a/xlators/nfs/server/src/nfs3-helpers.c +++ b/xlators/nfs/server/src/nfs3-helpers.c @@ -373,7 +373,7 @@ nfs3_stat_to_post_op_attr (struct iatt *buf) * returning these zeroed out attrs. */ attr.attributes_follow = FALSE; - if (nfs_zero_filled_stat (buf)) + if (gf_is_zero_filled_stat (buf)) goto out; nfs3_stat_to_fattr3 (buf, &(attr.post_op_attr_u.attributes)); @@ -394,7 +394,7 @@ nfs3_stat_to_pre_op_attr (struct iatt *pre) * returning these zeroed out attrs. */ poa.attributes_follow = FALSE; - if (nfs_zero_filled_stat (pre)) + if (gf_is_zero_filled_stat (pre)) goto out; poa.attributes_follow = TRUE; -- cgit