summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2019-05-14 10:56:15 -0400
committerAmar Tumballi <amarts@redhat.com>2019-06-08 05:42:19 +0000
commit2ff76fa45c53b8e291cf70c98b28800f3ed5f6fc (patch)
tree4fcdb3a9618b33966e49881df2b7d1bb7dfec58c
parentfa32b594d12673698da0c1dab8491db8655b4d50 (diff)
uss: Ensure that snapshot is deleted before creating a new snapshot
* Also some logging enhancements in snapview-server Change-Id: I6a7646771cedf4bd1c62806eea69d720bbaf0c83 fixes: bz#1715921 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
-rw-r--r--tests/basic/uss.t12
-rw-r--r--xlators/features/snapview-server/src/snapview-server-mgmt.c7
-rw-r--r--xlators/features/snapview-server/src/snapview-server.c4
-rw-r--r--xlators/features/snapview-server/src/snapview-server.h9
4 files changed, 29 insertions, 3 deletions
diff --git a/tests/basic/uss.t b/tests/basic/uss.t
index c8558050e36..09dd00ef995 100644
--- a/tests/basic/uss.t
+++ b/tests/basic/uss.t
@@ -36,6 +36,7 @@ TEST glusterd;
TEST pidof glusterd;
TEST $CLI volume create $V0 $H0:$L1 $H0:$L2 $H0:$L3;
+
TEST $CLI volume set $V0 nfs.disable false
@@ -374,6 +375,15 @@ TEST rm -f $M0/aaa;
TEST $CLI snapshot delete snap6;
+# drop the caches so that, the dentry for "snap6" is
+# is forgotten from the client cache.
+drop_cache $M0
+
+EXPECT_WITHIN 30 "5" count_snaps $M0;
+
+# This should fail, as snap6 just got deleted.
+TEST ! stat $M0/.history/snap6
+
TEST $CLI snapshot create snap6 $V0 no-timestamp
TEST ls $M0/.history;
@@ -384,6 +394,8 @@ TEST ls $M0/.history/snap6/;
TEST ! stat $M0/.history/snap6/aaa;
+TEST stat $M0
+
# done with the tests start cleaning up of things
TEST $CLI volume set $V0 features.uss disable
diff --git a/xlators/features/snapview-server/src/snapview-server-mgmt.c b/xlators/features/snapview-server/src/snapview-server-mgmt.c
index bc415efb81d..17b3515e9a9 100644
--- a/xlators/features/snapview-server/src/snapview-server-mgmt.c
+++ b/xlators/features/snapview-server/src/snapview-server-mgmt.c
@@ -407,7 +407,12 @@ mgmt_get_snapinfo_cbk(struct rpc_req *req, struct iovec *iov, int count,
if (old_dirents) {
for (i = 0; i < oldcount; i++) {
if (old_dirents[i].fs)
- glfs_fini(old_dirents[i].fs);
+ gf_msg_debug(this->name, 0,
+ "calling glfs_fini on "
+ "name: %s, snap_volname: %s, uuid: %s",
+ old_dirents[i].name, old_dirents[i].snap_volname,
+ old_dirents[i].uuid);
+ glfs_fini(old_dirents[i].fs);
}
}
diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c
index b4998b88a8e..52273c995c7 100644
--- a/xlators/features/snapview-server/src/snapview-server.c
+++ b/xlators/features/snapview-server/src/snapview-server.c
@@ -2002,7 +2002,9 @@ svs_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
"failed",
loc->name, uuid_utoa(loc->inode->gfid));
goto out;
- }
+ } else
+ gf_msg_debug(this->name, 0, "stat on %s (%s) successful", loc->path,
+ uuid_utoa(loc->inode->gfid));
iatt_from_stat(&buf, &stat);
gf_uuid_copy(buf.ia_gfid, loc->inode->gfid);
diff --git a/xlators/features/snapview-server/src/snapview-server.h b/xlators/features/snapview-server/src/snapview-server.h
index b25801901ed..42f22404b68 100644
--- a/xlators/features/snapview-server/src/snapview-server.h
+++ b/xlators/features/snapview-server/src/snapview-server.h
@@ -58,9 +58,16 @@
{ \
for (i = 0; i < _private->num_snaps; i++) { \
tmp_fs = _private->dirents[i].fs; \
- gf_log(this->name, GF_LOG_DEBUG, "dirent->fs: %p", tmp_fs); \
+ gf_log(this->name, GF_LOG_DEBUG, \
+ "snap name: %s, snap volume: %s," \
+ "dirent->fs: %p", \
+ _private->dirents[i].name, \
+ _private->dirents[i].snap_volname, tmp_fs); \
if (tmp_fs && fs && (tmp_fs == fs)) { \
found = _gf_true; \
+ gf_msg_debug(this->name, 0, \
+ "found the fs " \
+ "instance"); \
break; \
} \
} \