autobuild v3.12.2-17

Resolves: bz#1615578 bz#1619416 bz#1619538 bz#1620469 bz#1620765
Signed-off-by: Milind Changire <mchangir@redhat.com>
This commit is contained in:
Milind Changire 2018-08-23 10:09:40 -04:00
parent c459b4cbb4
commit 0cd70ea55b
9 changed files with 674 additions and 1 deletions

View File

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

View File

@ -0,0 +1,131 @@
From 69e6933898a37ef7c929b2d4b5561e5e3a407be4 Mon Sep 17 00:00:00 2001
From: Mohammed Rafi KC <rkavunga@redhat.com>
Date: Thu, 16 Aug 2018 17:04:22 +0530
Subject: [PATCH 353/359] snapshot/handshake: store description after strdup
problem:
During a handshake, when we import a friend data
snap description variable was just referenced to
dictionary value.
Solution:
snap description should have a separate memory allocated
through gf_strdup
>Change-Id: I94da0c57919e1228919231d1563a001362b100b8
>fixes: bz#1618004
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
upstream patch: https://review.gluster.org/#/c/glusterfs/+/20747/
Change-Id: I94da0c57919e1228919231d1563a001362b100b8
BUG: 1615578
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/147521
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
...-1618004-fix-memory-corruption-in-snap-import.t | 48 ++++++++++++++++++++++
.../mgmt/glusterd/src/glusterd-snapshot-utils.c | 17 ++++++--
2 files changed, 62 insertions(+), 3 deletions(-)
create mode 100644 tests/bugs/snapshot/bug-1618004-fix-memory-corruption-in-snap-import.t
diff --git a/tests/bugs/snapshot/bug-1618004-fix-memory-corruption-in-snap-import.t b/tests/bugs/snapshot/bug-1618004-fix-memory-corruption-in-snap-import.t
new file mode 100644
index 0000000..a2c004e
--- /dev/null
+++ b/tests/bugs/snapshot/bug-1618004-fix-memory-corruption-in-snap-import.t
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../snapshot.rc
+. $(dirname $0)/../../cluster.rc
+
+function get_volume_info ()
+{
+ local var=$1
+ $CLI_1 volume info $V0 | grep "^$var" | sed 's/.*: //'
+}
+
+cleanup;
+
+TEST verify_lvm_version
+TEST launch_cluster 2
+TEST setup_lvm 2
+
+TEST $CLI_1 peer probe $H2;
+EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count;
+
+TEST $CLI_1 volume create $V0 $H1:$L1 $H2:$L2
+EXPECT "$V0" get_volume_info 'Volume Name';
+EXPECT 'Created' get_volume_info 'Status';
+
+TEST $CLI_1 volume start $V0
+EXPECT 'Started' get_volume_info 'Status';
+
+
+# Setting system limit
+TEST $CLI_1 snapshot config activate-on-create enable
+
+TEST $CLI_1 snapshot create snap1 $V0 no-timestamp description "test"
+TEST kill_glusterd 1
+#deactivate snapshot for changing snap version, so that handshake will
+#happen when glusterd is restarted
+TEST $CLI_2 snapshot deactivate snap1
+TEST start_glusterd 1
+
+#Wait till handshake complete
+EXPECT_WITHIN ${PROCESS_UP_TIMEOUT} 'Stopped' snapshot_status snap1
+
+#Delete the snapshot, without this fix, delete will lead to assertion failure
+$CLI_1 snapshot delete all
+EXPECT '0' get_snap_count CLI_1;
+cleanup;
+
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
index ad206f6..48cf326 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
@@ -766,7 +766,7 @@ glusterd_add_snap_to_dict (glusterd_snap_t *snap, dict_t *peer_data,
}
if (snap->description) {
- snprintf (buf, sizeof(buf), "%s.snapid", prefix);
+ snprintf (buf, sizeof(buf), "%s.description", prefix);
ret = dict_set_dynstr_with_alloc (peer_data, buf,
snap->description);
if (ret) {
@@ -1551,6 +1551,7 @@ glusterd_import_friend_snap (dict_t *peer_data, int32_t snap_count,
{
char buf[NAME_MAX] = "";
char prefix[NAME_MAX] = "";
+ char *description = NULL;
dict_t *dict = NULL;
glusterd_snap_t *snap = NULL;
glusterd_volinfo_t *snap_vol = NULL;
@@ -1590,8 +1591,18 @@ glusterd_import_friend_snap (dict_t *peer_data, int32_t snap_count,
strncpy (snap->snapname, peer_snap_name, sizeof (snap->snapname) - 1);
gf_uuid_parse (peer_snap_id, snap->snap_id);
- snprintf (buf, sizeof(buf), "%s.snapid", prefix);
- ret = dict_get_str (peer_data, buf, &snap->description);
+ snprintf (buf, sizeof(buf), "%s.description", prefix);
+ ret = dict_get_str (peer_data, buf, &description);
+ if (ret == 0 && description) {
+ snap->description = gf_strdup (description);
+ if (snap->description == NULL) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ GD_MSG_SNAP_CREATION_FAIL,
+ "Saving the Snapshot Description Failed");
+ ret = -1;
+ goto out;
+ }
+ }
snprintf (buf, sizeof(buf), "%s.time_stamp", prefix);
ret = dict_get_int64 (peer_data, buf, &snap->time_stamp);
--
1.8.3.1

View File

@ -0,0 +1,44 @@
From 8e616a6badedec070098c2bc324e566b1a5d34b1 Mon Sep 17 00:00:00 2001
From: Mohammed Rafi KC <rkavunga@redhat.com>
Date: Sat, 18 Aug 2018 19:40:46 +0530
Subject: [PATCH 354/359] snapshot:Fix wrong dictionary key in snapshot cleanup
code
Snapshot was designed to support multiple volume snapshot,
hence the volume name keys are labelled with volume count.
So the volume key should have a volume count appended with
key
>Change-Id: I044d73fc86db0e662dc914669aecfb82a6476fb5
>fixes: bz#1618004
>Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
upstream patch: https://review.gluster.org/#/c/glusterfs/+/20854/
Change-Id: I044d73fc86db0e662dc914669aecfb82a6476fb5
BUG: 1615578
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/147524
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-snapshot.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot.c b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
index fdd5012..830a67f 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot.c
@@ -6529,7 +6529,8 @@ glusterd_do_snap_cleanup (dict_t *dict, char **op_errstr, dict_t *rsp_dict)
goto out;
}
- ret = dict_get_str (dict, "volname", &volname);
+ /* As of now snapshot of multiple volumes are not supported */
+ ret = dict_get_str (dict, "volname1", &volname);
if (ret) {
gf_msg ("glusterd", GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED, "Unable to get"
--
1.8.3.1

View File

@ -0,0 +1,38 @@
From 5f7e699d159577a41a35085648669ea56fa80bf0 Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Tue, 21 Aug 2018 10:54:46 +0530
Subject: [PATCH 355/359] server-protocol: resolve memory leak
This leak got introduced as part of d15e6e444 where 'alloca()' calls
were removed in server protocol. Notice that only 'lookup()' has
two places where there is return, hence we needed free in 2 places,
not 1.
BUG: 1619416
Change-Id: I32c20a33d7a1c8862588b50455765a92095469a6
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/147574
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/protocol/server/src/server-rpc-fops.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index a7fd3b5..35d0887 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -5871,6 +5871,9 @@ server3_3_lookup (rpcsvc_request_t *req)
ret = 0;
resolve_and_resume (frame, server_lookup_resume);
+ free (args.bname);
+ free (args.xdata.xdata_val);
+
return ret;
out:
free (args.bname);
--
1.8.3.1

View File

@ -0,0 +1,65 @@
From dba81543259bbb4b590918477156dfb68812dd8a Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Tue, 21 Aug 2018 19:33:08 +0530
Subject: [PATCH 356/359] io-stats: sanitize the dump path further
In the previous patch, while addressing the comment on review,
a "/" at the end of the "/var/run/gluster" directory was missed out.
Also noticed that the logic to convert the '/' to '-' for sanity
of the path needed to change.
Testing: Ran the tests which marked the bug as FailedQA,
and also validated the originally reported issue, and now we see
a specific log when not so clean path is given as the value to
this xattr.
BUG: 1605086
Change-Id: Ia8397ecd5841a72d0daca0106557e1226c293e35
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/147644
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/debug/io-stats/src/io-stats.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 868890f..16a11df 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -3014,7 +3014,7 @@ conditional_dump (dict_t *dict, char *key, data_t *value, void *data)
char *filename = NULL;
FILE *logfp = NULL;
struct ios_dump_args args = {0};
- int pid, namelen;
+ int pid, namelen, dirlen;
char dump_key[100];
char *slash_ptr = NULL;
char *path_in_value = NULL;
@@ -3039,16 +3039,17 @@ conditional_dump (dict_t *dict, char *key, data_t *value, void *data)
"%s: no \"../\" allowed in path", path_in_value);
return -1;
}
- namelen = (strlen (IOS_STATS_DUMP_DIR) + value->len +
- strlen (this->name) + 2); /* '.' and '\0' */
+ dirlen = strlen (IOS_STATS_DUMP_DIR);
+ namelen = (dirlen + value->len + strlen (this->name) + 3);
+ /* +3 for '/', '.' and '\0' added in snprintf below*/
filename = alloca0 (namelen);
- snprintf (filename, namelen, "%s%s.%s", IOS_STATS_DUMP_DIR,
+ snprintf (filename, namelen, "%s/%s.%s", IOS_STATS_DUMP_DIR,
path_in_value, this->name);
/* convert any slashes to '-' so that fopen works correctly */
- slash_ptr = strchr (filename + value->len + 1, '/');
+ slash_ptr = strchr (filename + dirlen + 1, '/');
while (slash_ptr) {
*slash_ptr = '-';
slash_ptr = strchr (slash_ptr, '/');
--
1.8.3.1

View File

@ -0,0 +1,76 @@
From 395a535ec778f34e0b17150a6a37ac25790f760d Mon Sep 17 00:00:00 2001
From: Sunny Kumar <sunkumar@redhat.com>
Date: Wed, 22 Aug 2018 02:08:40 +0530
Subject: [PATCH 357/359] snapshot : fix snapshot status failure due to symlink
problem
Problems : 1. Snapshot status for individual snapshots were failing after OS
upgrade from RHEL6 to RHEL7.
2. Post upgrade snapshot creation of cloned volume was failing.
Root Cause : When OS upgrade is from RHEL6 to RHEL7 there is difference in
symlink (/var/run) between these two versions.
Basically when (/var/run) is symlinked to /run, mount command
resolves path and mounts it. But at the same time call to
those functions fails who depends on absolute path.
(like strcmp in glusterd_get_mnt_entry_info)
Solution : Resolve the input path to absolute path before calling these
functions.
Test : Tested on same setup where issue was reported. After this
patch snapshot issues are completely resolved.
Upstream Patch : https://review.gluster.org/#/c/glusterfs/+/20885/
Change-Id: I5ba57998cea614c6072709f52f42a57562018844
BUG: 1619538
>fixes: bz#1619843
>Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
Change-Id: I6bc045f0baa6c858da43d6c8324ae690d76dc842
Reviewed-on: https://code.engineering.redhat.com/gerrit/147812
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-utils.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 1752425..136a032 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -7030,6 +7030,7 @@ glusterd_get_mnt_entry_info (char *mnt_pt, char *buff, int buflen,
{
struct mntent *entry = NULL;
FILE *mtab = NULL;
+ char abspath[PATH_MAX] = "";
GF_ASSERT (mnt_pt);
GF_ASSERT (buff);
@@ -7039,13 +7040,20 @@ glusterd_get_mnt_entry_info (char *mnt_pt, char *buff, int buflen,
if (!mtab)
goto out;
+ if (!realpath (mnt_pt, abspath)) {
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ GD_MSG_MNTENTRY_GET_FAIL,
+ "realpath () failed for path %s", mnt_pt);
+ goto out;
+ }
+
entry = getmntent_r (mtab, entry_ptr, buff, buflen);
while (1) {
if (!entry)
goto out;
- if (!strcmp (entry->mnt_dir, mnt_pt) &&
+ if (!strcmp (entry->mnt_dir, abspath) &&
strcmp (entry->mnt_type, "rootfs"))
break;
entry = getmntent_r (mtab, entry_ptr, buff, buflen);
--
1.8.3.1

View File

@ -0,0 +1,101 @@
From 8f1a849968242aa3c53a05fbf1b0647a905e9cdd Mon Sep 17 00:00:00 2001
From: Atin Mukherjee <amukherj@redhat.com>
Date: Thu, 23 Aug 2018 12:12:36 +0530
Subject: [PATCH 358/359] glusterd: glusterd_brick_start shouldn't try to bring
up brick if only_connect is true
With the latest refactoring in glusterd_brick_start () function in case
we run into a situation where is_gf_service_running () return a valid
pid which is running but doesn't belong to a gluster process, even in
case of only_connect flag passed as gf_true we'd end up trying to start
a brick which would cause a deadlock in brick multiplexing as both
glusterd_restart_bricks () and glusterd_do_volume_quorum_action () would
cause context switching with each other for the same brick. The
following bt shows the same:
(gdb) t a a bt
Thread 8 (Thread 0x7fcced48a700 (LWP 11959)):
srch_vol=srch_vol@entry=0xbe0410, comp_vol=comp_vol@entry=0xc03680,
brickinfo=brickinfo@entry=0xc14ef0) at glusterd-utils.c:5834
brickinfo=0xc14ef0, volinfo=0xc03680, conf=<optimized out>)
at glusterd-utils.c:5902
brickinfo=brickinfo@entry=0xc14ef0, wait=wait@entry=_gf_false,
only_connect=only_connect@entry=_gf_true) at glusterd-utils.c:6251
volinfo=0xc03680, meets_quorum=_gf_true) at glusterd-server-quorum.c:402
at glusterd-server-quorum.c:443
iov=iov@entry=0x7fcce0004040, count=count@entry=1,
myframe=myframe@entry=0x7fcce00023a0) at glusterd-rpc-ops.c:542
iov=0x7fcce0004040, count=1, myframe=0x7fcce00023a0,
fn=0x7fccf12403d0 <__glusterd_friend_add_cbk>) at glusterd-rpc-ops.c:223
---Type <return> to continue, or q <return> to quit---
at rpc-transport.c:538
Thread 7 (Thread 0x7fccedc8b700 (LWP 11958)):
Thread 6 (Thread 0x7fccf1d67700 (LWP 11877)):
brickinfo=brickinfo@entry=0xc14ef0) at glusterd-utils.c:5834
at glusterd-utils.c:6251
Thread 5 (Thread 0x7fccf2568700 (LWP 11876)):
Thread 4 (Thread 0x7fccf2d69700 (LWP 11875)):
Thread 3 (Thread 0x7fccf356a700 (LWP 11874)):
Thread 2 (Thread 0x7fccf3d6b700 (LWP 11873)):
---Type <return> to continue, or q <return> to quit---
Thread 1 (Thread 0x7fccf68a8780 (LWP 11872)):
Fix:
The solution is to ensure we don't restart bricks if only_connect is
true and just ensure that the brick is attempted to be connected.
Test:
Simulated a code change to ensure gf_is_service_running () always return
to true to hit the scenario.
>upstream patch : https://review.gluster.org/#/c/glusterfs/+/20935
>Change-Id: Iec184e6c9e8aabef931d310f931f4d7a580f0f48
>Fixes: bz#1620544
>Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Change-Id: Iec184e6c9e8aabef931d310f931f4d7a580f0f48
BUG: 1620469
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/147888
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
xlators/mgmt/glusterd/src/glusterd-utils.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 136a032..b9e8d8d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -6173,6 +6173,8 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
if (sys_access (pidfile , R_OK) == 0) {
sys_unlink (pidfile);
}
+ if (only_connect)
+ return 0;
goto run;
}
GF_FREE (brickpath);
@@ -6187,6 +6189,8 @@ glusterd_brick_start (glusterd_volinfo_t *volinfo,
if (sys_access (pidfile , R_OK) == 0) {
sys_unlink (pidfile);
}
+ if (only_connect)
+ return 0;
goto run;
}
}
--
1.8.3.1

View File

@ -0,0 +1,137 @@
From 5b628662aa823770179c5592c182dd8b6acc9b1d Mon Sep 17 00:00:00 2001
From: N Balachandran <nbalacha@redhat.com>
Date: Thu, 23 Aug 2018 18:38:01 +0530
Subject: [PATCH 359/359] storage/posix: Increment trusted.pgfid in posix_mknod
The value of trusted.pgfid.xx was always set to 1
in posix_mknod. This is incorrect if posix_mknod
calls posix_create_link_if_gfid_exists.
upstream patch: https://review.gluster.org/#/c/glusterfs/+/20875/
> Change-Id: Ibe87ca6f155846b9a7c7abbfb1eb8b6a99a5eb68
> fixes: bz#1619720
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
Change-Id: Iaa7ad44b918eed28718f62c312f2d8edf01b9256
BUG: 1620765
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/147891
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: RHGS Build Bot <nigelb@redhat.com>
---
tests/bugs/posix/bug-1619720.t | 57 +++++++++++++++++++++++++++++++++++++++
xlators/storage/posix/src/posix.c | 18 ++++++++++---
2 files changed, 71 insertions(+), 4 deletions(-)
create mode 100755 tests/bugs/posix/bug-1619720.t
diff --git a/tests/bugs/posix/bug-1619720.t b/tests/bugs/posix/bug-1619720.t
new file mode 100755
index 0000000..5e0d0f7
--- /dev/null
+++ b/tests/bugs/posix/bug-1619720.t
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../dht.rc
+
+cleanup;
+
+
+# Test steps:
+# The test checks to make sure that the trusted.pgfid.xx xattr is set on
+# both the linkto and data files post the final rename.
+# The test creates files file-1 and file-3 so that src_hashed = dst_hashed,
+# src_cached = dst_cached and xxx_hashed != xxx_cached.
+# It then renames file-1 to file-3 which triggers the posix_mknod call
+# which updates the trusted.pgfid.xx xattr.
+
+
+TEST glusterd
+TEST pidof glusterd
+
+TEST $CLI volume create $V0 $H0:$B0/${V0}0 $H0:$B0/${V0}1
+TEST $CLI volume start $V0
+TEST $CLI volume set $V0 storage.build-pgfid on
+
+## Mount FUSE
+TEST glusterfs -s $H0 --volfile-id $V0 $M0;
+
+TEST mkdir $M0/tmp
+
+
+
+# Not the best way to do this but I need files which hash to the same subvol and
+# whose cached subvols are the same.
+# In a 2 subvol distributed volume, file-{1,3} hash to the same subvol.
+# file-2 will hash to the other subvol
+
+TEST touch $M0/tmp/file-2
+pgfid_xattr_name=$(getfattr -m "trusted.pgfid.*" $B0/${V0}1/tmp/file-2 | grep "trusted.pgfid")
+echo $pgfid_xattr_name
+
+
+TEST mv $M0/tmp/file-2 $M0/tmp/file-1
+TEST touch $M0/tmp/file-2
+TEST mv $M0/tmp/file-2 $M0/tmp/file-3
+
+# At this point, both the file-1 and file-3 data files exist on one subvol
+# and both linkto files on the other
+
+TEST mv -f $M0/tmp/file-1 $M0/tmp/file-3
+
+TEST getfattr -n $pgfid_xattr_name $B0/${V0}0/tmp/file-3
+TEST getfattr -n $pgfid_xattr_name $B0/${V0}1/tmp/file-3
+
+# Not required for the test but an extra check if required.
+# The linkto file was not renamed Without the fix.
+#TEST mv $M0/tmp/file-3 $M0/tmp/file-6
+cleanup;
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 28d2e6f..5088469 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -1427,6 +1427,7 @@ posix_mknod (call_frame_t *frame, xlator_t *this,
gf_boolean_t entry_created = _gf_false, gfid_set = _gf_false;
gf_boolean_t linked = _gf_false;
gf_loglevel_t level = GF_LOG_NONE;
+ posix_inode_ctx_t *ctx = NULL;
DECLARE_OLD_FS_ID_VAR;
@@ -1556,10 +1557,20 @@ post_op:
if (priv->update_pgfid_nlinks) {
MAKE_PGFID_XATTR_KEY (pgfid_xattr_key, PGFID_XATTR_KEY_PREFIX,
loc->pargfid);
- nlink_samepgfid = 1;
+ op_ret = posix_inode_ctx_get_all (loc->inode, this, &ctx);
+ if (op_ret < 0) {
+ op_errno = ENOMEM;
+ goto out;
+ }
- SET_PGFID_XATTR (real_path, pgfid_xattr_key, nlink_samepgfid,
- XATTR_CREATE, op_ret, this, ignore);
+ pthread_mutex_lock (&ctx->pgfid_lock);
+ {
+ LINK_MODIFY_PGFID_XATTR (real_path, pgfid_xattr_key,
+ nlink_samepgfid, 0, op_ret,
+ this, unlock);
+ }
+unlock:
+ pthread_mutex_unlock (&ctx->pgfid_lock);
}
if (priv->gfid2path) {
@@ -1567,7 +1578,6 @@ post_op:
loc->name);
}
-ignore:
op_ret = posix_entry_create_xattr_set (this, real_path, xdata);
if (op_ret) {
if (errno != EEXIST)
--
1.8.3.1

View File

@ -192,7 +192,7 @@ Release: 0.1%{?prereltag:.%{prereltag}}%{?dist}
%else
Name: glusterfs
Version: 3.12.2
Release: 16%{?dist}
Release: 17%{?dist}
%endif
License: GPLv2 or LGPLv3+
Group: System Environment/Base
@ -616,6 +616,14 @@ Patch0348: 0348-posix-disable-block-and-character-files.patch
Patch0349: 0349-posix-don-t-allow-.-path-in-name.patch
Patch0350: 0350-cluster-dht-fix-inode-ref-management-in-dht_heal_pat.patch
Patch0351: 0351-cluster-dht-Fixed-rebalanced-files.patch
Patch0352: 0352-snapshot-Fail-snapshot-creation-if-an-empty-descript.patch
Patch0353: 0353-snapshot-handshake-store-description-after-strdup.patch
Patch0354: 0354-snapshot-Fix-wrong-dictionary-key-in-snapshot-cleanu.patch
Patch0355: 0355-server-protocol-resolve-memory-leak.patch
Patch0356: 0356-io-stats-sanitize-the-dump-path-further.patch
Patch0357: 0357-snapshot-fix-snapshot-status-failure-due-to-symlink-.patch
Patch0358: 0358-glusterd-glusterd_brick_start-shouldn-t-try-to-bring.patch
Patch0359: 0359-storage-posix-Increment-trusted.pgfid-in-posix_mknod.patch
%description
GlusterFS is a distributed file-system capable of scaling to several
@ -2564,6 +2572,9 @@ fi
%endif
%changelog
* Thu Aug 23 2018 Milind Changire <mchangir@redhat.com> - 3.12.2-17
- fixes bugs bz#1615578 bz#1619416 bz#1619538 bz#1620469 bz#1620765
* Tue Aug 14 2018 Milind Changire <mchangir@redhat.com> - 3.12.2-16
- fixes bugs bz#1569657 bz#1608352 bz#1609163 bz#1609724 bz#1610825
bz#1611151 bz#1612098 bz#1615338 bz#1615440