|
|
a3470f |
From d463acc86f218abeba9a95b49702a5be491f3110 Mon Sep 17 00:00:00 2001
|
|
|
a3470f |
From: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
a3470f |
Date: Sat, 18 Aug 2018 01:25:34 +0530
|
|
|
a3470f |
Subject: [PATCH 352/359] snapshot:Fail snapshot creation if an empty
|
|
|
a3470f |
description provided
|
|
|
a3470f |
|
|
|
a3470f |
Snapshot description should have a valid string. Creating a
|
|
|
a3470f |
snapshot with null value will cause reading from info file
|
|
|
a3470f |
to fail with a null exception
|
|
|
a3470f |
|
|
|
a3470f |
>Change-Id: I9f84154b8e3e7ffefa5438807b3bb9b4e0d964ca
|
|
|
a3470f |
>updates: bz#1618004
|
|
|
a3470f |
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
a3470f |
|
|
|
a3470f |
upstream patch: https://review.gluster.org/#/c/glusterfs/+/20770/
|
|
|
a3470f |
|
|
|
a3470f |
Change-Id: I9f84154b8e3e7ffefa5438807b3bb9b4e0d964ca
|
|
|
a3470f |
BUG: 1615578
|
|
|
a3470f |
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
|
|
|
a3470f |
Reviewed-on: https://code.engineering.redhat.com/gerrit/147517
|
|
|
a3470f |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
a3470f |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
a3470f |
---
|
|
|
a3470f |
tests/basic/uss.t | 1 +
|
|
|
a3470f |
xlators/mgmt/glusterd/src/glusterd-snapshot.c | 10 ++++++++++
|
|
|
a3470f |
2 files changed, 11 insertions(+)
|
|
|
a3470f |
|
|
|
a3470f |
diff --git a/tests/basic/uss.t b/tests/basic/uss.t
|
|
|
a3470f |
index 6cfc030..40e556e 100644
|
|
|
a3470f |
--- a/tests/basic/uss.t
|
|
|
a3470f |
+++ b/tests/basic/uss.t
|
|
|
a3470f |
@@ -52,6 +52,7 @@ TEST ln $M0/f1 $M0/dir/f3
|
|
|
a3470f |
TEST $CLI snapshot config activate-on-create enable
|
|
|
a3470f |
TEST $CLI volume set $V0 features.uss enable;
|
|
|
a3470f |
|
|
|
a3470f |
+TEST ! $CLI snapshot create snap1 $V0 no-timestamp description "";
|
|
|
a3470f |
TEST $CLI snapshot create snap1 $V0 no-timestamp;
|
|
|
a3470f |
|
|
|
a3470f |
for i in {11..20} ; do echo "file" > $M0/file$i ; done
|
|
|
a3470f |
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
|
|
|
a3470f |
index 09e10bf..fdd5012 100644
|
|
|
a3470f |
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
|
|
|
a3470f |
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
|
|
|
a3470f |
@@ -2518,6 +2518,7 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
|
|
|
a3470f |
int64_t effective_max_limit = 0;
|
|
|
a3470f |
int flags = 0;
|
|
|
a3470f |
uint64_t opt_hard_max = GLUSTERD_SNAPS_MAX_HARD_LIMIT;
|
|
|
a3470f |
+ char *description = NULL;
|
|
|
a3470f |
|
|
|
a3470f |
this = THIS;
|
|
|
a3470f |
GF_ASSERT (op_errstr);
|
|
|
a3470f |
@@ -2544,6 +2545,15 @@ glusterd_snapshot_create_prevalidate (dict_t *dict, char **op_errstr,
|
|
|
a3470f |
goto out;
|
|
|
a3470f |
}
|
|
|
a3470f |
|
|
|
a3470f |
+ ret = dict_get_str (dict, "description", &description);
|
|
|
a3470f |
+ if (description && !(*description)) {
|
|
|
a3470f |
+ /* description should have a non-null value */
|
|
|
a3470f |
+ ret = -1;
|
|
|
a3470f |
+ snprintf (err_str, sizeof (err_str), "Snapshot cannot be "
|
|
|
a3470f |
+ "created with empty description");
|
|
|
a3470f |
+ goto out;
|
|
|
a3470f |
+ }
|
|
|
a3470f |
+
|
|
|
a3470f |
ret = dict_get_int32 (dict, "flags", &flags);
|
|
|
a3470f |
if (ret) {
|
|
|
a3470f |
gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
a3470f |
--
|
|
|
a3470f |
1.8.3.1
|
|
|
a3470f |
|