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