50dc83
From 71ff9b7c6356e521d98ee025554b63dd23db9836 Mon Sep 17 00:00:00 2001
50dc83
From: Kotresh HR <khiremat@redhat.com>
50dc83
Date: Thu, 13 Jun 2019 22:43:47 +0530
50dc83
Subject: [PATCH 217/221] uss: Fix tar issue with ctime and uss enabled
50dc83
50dc83
Problem:
50dc83
If ctime and uss enabled, tar still complains with 'file
50dc83
changed as we read it'
50dc83
50dc83
Cause:
50dc83
To clear nfs cache (gluster-nfs), the ctime was incremented
50dc83
in snap-view client on stat cbk.
50dc83
50dc83
Fix:
50dc83
The ctime should not be incremented manually. Since gluster-nfs
50dc83
is planning to be deprecated, this code is being removed to
50dc83
fix the issue.
50dc83
50dc83
Backport of:
50dc83
 > Patch: https://review.gluster.org/22861
50dc83
 > Change-Id: Iae7f100c20fce880a50b008ba716077350281404
50dc83
 > fixes: bz#1720290
50dc83
 > Signed-off-by: Kotresh HR <khiremat@redhat.com>
50dc83
50dc83
Change-Id: Iae7f100c20fce880a50b008ba716077350281404
50dc83
BUG: 1709301
50dc83
Signed-off-by: Kotresh HR <khiremat@redhat.com>
50dc83
Reviewed-on: https://code.engineering.redhat.com/gerrit/173922
50dc83
Tested-by: RHGS Build Bot <nigelb@redhat.com>
50dc83
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
50dc83
---
50dc83
 .../features/snapview-client/src/snapview-client.c | 22 +++++++++++++---------
50dc83
 1 file changed, 13 insertions(+), 9 deletions(-)
50dc83
50dc83
diff --git a/xlators/features/snapview-client/src/snapview-client.c b/xlators/features/snapview-client/src/snapview-client.c
50dc83
index 5d7986c..9c789ae 100644
50dc83
--- a/xlators/features/snapview-client/src/snapview-client.c
50dc83
+++ b/xlators/features/snapview-client/src/snapview-client.c
50dc83
@@ -577,20 +577,24 @@ gf_svc_stat_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
50dc83
                 int32_t op_ret, int32_t op_errno, struct iatt *buf,
50dc83
                 dict_t *xdata)
50dc83
 {
50dc83
-    /* Consider a testcase:
50dc83
+    /* TODO: FIX ME
50dc83
+     * Consider a testcase:
50dc83
      * #mount -t nfs host1:/vol1 /mnt
50dc83
      * #ls /mnt
50dc83
      * #ls /mnt/.snaps (As expected this fails)
50dc83
      * #gluster volume set vol1 features.uss enable
50dc83
-     * Now `ls /mnt/.snaps` should work,
50dc83
-     * but fails with No such file or directory.
50dc83
-     * This is because NFS client caches the list of files in
50dc83
-     * a directory. This cache is updated if there are any changes
50dc83
-     * in the directory attributes. To solve this problem change
50dc83
-     * a attribute 'ctime' when USS is enabled
50dc83
+     * Now `ls /mnt/.snaps` should work, but fails with No such file or
50dc83
+     * directory. This is because NFS client (gNFS) caches the list of files
50dc83
+     * in a directory. This cache is updated if there are any changes in the
50dc83
+     * directory attributes. So, one way to solve this problem is to change
50dc83
+     * 'ctime' attribute when USS is enabled as below.
50dc83
+     *
50dc83
+     * if (op_ret == 0 && IA_ISDIR(buf->ia_type))
50dc83
+     *     buf->ia_ctime_nsec++;
50dc83
+     *
50dc83
+     * But this is not the ideal solution as applications see the unexpected
50dc83
+     * ctime change causing failures.
50dc83
      */
50dc83
-    if (op_ret == 0 && IA_ISDIR(buf->ia_type))
50dc83
-        buf->ia_ctime_nsec++;
50dc83
 
50dc83
     SVC_STACK_UNWIND(stat, frame, op_ret, op_errno, buf, xdata);
50dc83
     return 0;
50dc83
-- 
50dc83
1.8.3.1
50dc83