3604df
From 6e912edf580252d4eb967a5bffedbb1f42931a21 Mon Sep 17 00:00:00 2001
3604df
From: Poornima G <pgurusid@redhat.com>
3604df
Date: Thu, 25 Aug 2016 10:25:24 +0530
3604df
Subject: [PATCH 121/141] md-cache: Do not use features.cache-invalidation for both md-cache and upcall
3604df
3604df
Currently, the volume set option features.cache-invalidation enables upcall
3604df
feature on server side and md-cache cache-invalidation on client side.
3604df
There are multiple problems that can arise from this:
3604df
1. The scenario when user wants to, enable upcall for nfs-ganesha setup,
3604df
   but do not want to enable md-cache cache-invalidation, as the
3604df
   nfs-clients have already cached the metadata and upcall is used to
3604df
   to invalidate the nfs-client cache. In this case, users should have
3604df
   a way of disabling md-cache invalidation without disabling upcall.
3604df
3604df
2. Upcall requires a op-version of GD_OP_VERSION_3_7_0, where as
3604df
   md-cache invalidation requires an op version of GD_OP_VERSION_3_9_0.
3604df
   Consider a setup where the servers are in op-version GD_OP_VERSION_3_7_0,
3604df
   and th clients are in op-version GD_OP_VERSION_3_9_0. if there is one
3604df
   single volume set option, user can enable this feature in this setup.
3604df
   But it can lead to stale xattr cache as the xattr invalidation was
3604df
   introduced in upcall only in release 3.8. Hence, we should not be
3604df
   able to enable md-cache invalidation, if all the servers and clients
3604df
   are not on opversion >= GD_OP_VERSION_3_9_0.
3604df
3604df
To solve the above mentioned issues, we have seperate volume options
3604df
for enabling md-cache invalidation and upcall. But this can lead to
3604df
issues when user enable md-cache invalidation and forgets to enable
3604df
upcall. Probably in the next release, these can be enables by default.
3604df
3604df
Change-Id: Ie70eff97fe12fcb623eec8f4f5861ac065bf483e
3604df
BUG: 1284873
3604df
Signed-off-by: Poornima G <pgurusid@redhat.com>
3604df
Reviewed-on: http://review.gluster.org/15314
3604df
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
Reviewed-by: soumya k <skoduri@redhat.com>
3604df
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/87034
3604df
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
3604df
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
3604df
---
3604df
 tests/bugs/md-cache/bug-1211863.t               |    7 ++++---
3604df
 xlators/mgmt/glusterd/src/glusterd-volume-set.c |    2 +-
3604df
 xlators/performance/md-cache/src/md-cache.c     |    4 ++--
3604df
 3 files changed, 7 insertions(+), 6 deletions(-)
3604df
3604df
diff --git a/tests/bugs/md-cache/bug-1211863.t b/tests/bugs/md-cache/bug-1211863.t
3604df
index 4fa9e33..ece42fe 100644
3604df
--- a/tests/bugs/md-cache/bug-1211863.t
3604df
+++ b/tests/bugs/md-cache/bug-1211863.t
3604df
@@ -42,16 +42,17 @@ EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M1
3604df
 
3604df
 TEST $CLI volume set $V0 features.cache-invalidation on
3604df
 TEST $CLI volume set $V0 features.cache-invalidation-timeout 600
3604df
+TEST $CLI volume set $V0 performance.cache-invalidation on
3604df
 
3604df
-## 18. Restart the volume to restart the bick process
3604df
+## 19. Restart the volume to restart the bick process
3604df
 TEST $CLI volume stop $V0
3604df
 TEST $CLI volume start $V0
3604df
 
3604df
-## 20. Create two gluster mounts
3604df
+## 21. Create two gluster mounts
3604df
 TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0
3604df
 TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M1
3604df
 
3604df
-## 22. Repeat the tests 11-14, but this time since cache invalidation is on,
3604df
+## 23. Repeat the tests 11-14, but this time since cache invalidation is on,
3604df
        #the getxattr will reflect the new value
3604df
 TEST "setfattr -n user.DOSATTRIB -v "abc" $M0/file1"
3604df
 TEST "getfattr -n user.DOSATTRIB $M1/file1 | grep -q abc"
3604df
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
3604df
index de7bcb4..a293021 100644
3604df
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
3604df
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
3604df
@@ -1967,7 +1967,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
3604df
           .op_version = 2,
3604df
           .flags      = OPT_FLAG_CLIENT_OPT
3604df
         },
3604df
-        { .key        = "features.cache-invalidation",
3604df
+        { .key        = "performance.cache-invalidation",
3604df
           .voltype    = "performance/md-cache",
3604df
           .option     = "cache-invalidation",
3604df
           .op_version = GD_OP_VERSION_3_9_0,
3604df
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
3604df
index ab6dcff..ab9860b 100644
3604df
--- a/xlators/performance/md-cache/src/md-cache.c
3604df
+++ b/xlators/performance/md-cache/src/md-cache.c
3604df
@@ -2811,8 +2811,8 @@ struct volume_options options[] = {
3604df
         { .key = {"cache-invalidation"},
3604df
           .type = GF_OPTION_TYPE_BOOL,
3604df
           .default_value = "false",
3604df
-          .description = "When \"on\", invalidates/updates the metadata cache "
3604df
-                         "on receiving of the cache-invalidation notifications",
3604df
+          .description = "When \"on\", invalidates/updates the metadata cache,"
3604df
+                         " on receiving the cache-invalidation notifications",
3604df
         },
3604df
     { .key = {NULL} },
3604df
 };
3604df
-- 
3604df
1.7.1
3604df