From 4797c9e01fcfcadd19efe7c9096e34fbdb0947d5 Mon Sep 17 00:00:00 2001 From: Sunil Kumar Acharya Date: Mon, 5 Aug 2019 21:15:42 -0400 Subject: [PATCH] autobuild v6.0-11 Resolves: bz#1704562 bz#1733520 bz#1734423 Signed-off-by: Sunil Kumar Acharya --- 0263-tests-fix-ctime-related-tests.patch | 75 +++++ ...Fix-deadlock-while-processing-upcall.patch | 259 ++++++++++++++++++ ...dd-missing-GF_FREE-to-fuse_interrupt.patch | 47 ++++ glusterfs.spec | 8 +- 4 files changed, 388 insertions(+), 1 deletion(-) create mode 100644 0263-tests-fix-ctime-related-tests.patch create mode 100644 0264-gfapi-Fix-deadlock-while-processing-upcall.patch create mode 100644 0265-fuse-add-missing-GF_FREE-to-fuse_interrupt.patch diff --git a/0263-tests-fix-ctime-related-tests.patch b/0263-tests-fix-ctime-related-tests.patch new file mode 100644 index 0000000..3c8fabb --- /dev/null +++ b/0263-tests-fix-ctime-related-tests.patch @@ -0,0 +1,75 @@ +From 427dab431f7e8c4c8a01e9e9ed0892708a3d22d2 Mon Sep 17 00:00:00 2001 +From: Atin Mukherjee +Date: Mon, 5 Aug 2019 08:33:29 +0530 +Subject: [PATCH 263/265] tests: fix ctime related tests + +With ctime being disabled by default, certain tests need to explicitly +turn this option off to sanitize the functionality + +Label: DOWNSTREAM ONLY + +Change-Id: Id70310b4b09e36bf66756fea447186bb073b5604 +BUG: 1704562 +Signed-off-by: Atin Mukherjee +Reviewed-on: https://code.engineering.redhat.com/gerrit/177704 +Tested-by: RHGS Build Bot +Reviewed-by: Sunil Kumar Heggodu Gopala Acharya +--- + tests/basic/ctime/ctime-noatime.t | 1 + + tests/basic/ctime/ctime-readdir.t | 1 + + tests/bugs/glusterd/bug-1696046.t | 8 +++++--- + 3 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/tests/basic/ctime/ctime-noatime.t b/tests/basic/ctime/ctime-noatime.t +index 609ccbd..a6c8d9c 100644 +--- a/tests/basic/ctime/ctime-noatime.t ++++ b/tests/basic/ctime/ctime-noatime.t +@@ -20,6 +20,7 @@ function atime_compare { + TEST glusterd + TEST pidof glusterd + TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2} ++TEST $CLI volume set $V0 ctime on + TEST $CLI volume set $V0 performance.stat-prefetch off + TEST $CLI volume set $V0 performance.read-ahead off + TEST $CLI volume set $V0 performance.quick-read off +diff --git a/tests/basic/ctime/ctime-readdir.t b/tests/basic/ctime/ctime-readdir.t +index 4564fc1..fa069b3 100644 +--- a/tests/basic/ctime/ctime-readdir.t ++++ b/tests/basic/ctime/ctime-readdir.t +@@ -9,6 +9,7 @@ TEST glusterd + + TEST $CLI volume create $V0 replica 3 ${H0}:$B0/brick{1,2,3}; + TEST $CLI volume set $V0 performance.stat-prefetch on ++TEST $CLI volume set $V0 ctime on + TEST $CLI volume set $V0 performance.readdir-ahead off + TEST $CLI volume start $V0; + +diff --git a/tests/bugs/glusterd/bug-1696046.t b/tests/bugs/glusterd/bug-1696046.t +index e1c1eb2..f7992f5 100644 +--- a/tests/bugs/glusterd/bug-1696046.t ++++ b/tests/bugs/glusterd/bug-1696046.t +@@ -22,6 +22,8 @@ TEST pidof glusterd; + TEST $CLI volume set all cluster.brick-multiplex on + TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{1,2,3}; + TEST $CLI volume create $V1 replica 3 $H0:$B0/${V1}{1,2,3}; ++TEST $CLI volume set $V0 ctime on ++TEST $CLI volume set $V1 ctime on + + ## Start volume and verify + TEST $CLI volume start $V0; +@@ -64,9 +66,9 @@ TEST $CLI volume set $V0 diagnostics.brick-log-level DEBUG + # Do some operation + touch $M0/file1 + +-# Check debug message debug message should be exist only for V0 +-# Server xlator is common in brick_mux so after enabling DEBUG log +-# some debug message should be available for other xlators like posix ++# Check debug message should exist only for V0 server xlator is common in ++# brick_mux so after enabling DEBUG log some debug message should be available ++# for other xlators like posix + + brick_log_file=$logdir"/bricks/"`brick-log-file-name` + nofdlog=$(cat $brick_log_file | grep file1 | grep -v server | wc -l) +-- +1.8.3.1 + diff --git a/0264-gfapi-Fix-deadlock-while-processing-upcall.patch b/0264-gfapi-Fix-deadlock-while-processing-upcall.patch new file mode 100644 index 0000000..41ac9ee --- /dev/null +++ b/0264-gfapi-Fix-deadlock-while-processing-upcall.patch @@ -0,0 +1,259 @@ +From 52dc121c412de9c1cc3058d782b949dc7b25dc3e Mon Sep 17 00:00:00 2001 +From: Soumya Koduri +Date: Thu, 25 Jul 2019 12:56:12 +0530 +Subject: [PATCH 264/265] gfapi: Fix deadlock while processing upcall + +As mentioned in bug1733166, there could be potential deadlock +while processing upcalls depending on how each xlator choose +to act on it. The right way of fixing such issues +is to change rpc callback communication process. +- https://github.com/gluster/glusterfs/issues/697 + +Till then, making changes in gfapi layer to avoid any I/O +processing. + +This is backport of below mainline patch +> https://review.gluster.org/#/c/glusterfs/+/23108/ +> bz#1733166 +> https://review.gluster.org/#/c/glusterfs/+/23107/ (release-6) + +Change-Id: I2079e95339e5d761d5060707f4555cfacab95c83 +fixes: bz#1733520 +Signed-off-by: Soumya Koduri +Reviewed-on: https://code.engineering.redhat.com/gerrit/177675 +Tested-by: RHGS Build Bot +Reviewed-by: Sunil Kumar Heggodu Gopala Acharya +--- + api/src/glfs-fops.c | 164 +++++++++++++++++++++++++++++++++++++++++----------- + 1 file changed, 131 insertions(+), 33 deletions(-) + +diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c +index 396f18c..e6adea5 100644 +--- a/api/src/glfs-fops.c ++++ b/api/src/glfs-fops.c +@@ -34,7 +34,7 @@ + + struct upcall_syncop_args { + struct glfs *fs; +- struct glfs_upcall *up_arg; ++ struct gf_upcall upcall_data; + }; + + #define READDIRBUF_SIZE (sizeof(struct dirent) + GF_NAME_MAX + 1) +@@ -5716,8 +5716,28 @@ out: + static int + upcall_syncop_args_free(struct upcall_syncop_args *args) + { +- if (args && args->up_arg) +- GLFS_FREE(args->up_arg); ++ dict_t *dict = NULL; ++ struct gf_upcall *upcall_data = NULL; ++ ++ if (args) { ++ upcall_data = &args->upcall_data; ++ switch (upcall_data->event_type) { ++ case GF_UPCALL_CACHE_INVALIDATION: ++ dict = ((struct gf_upcall_cache_invalidation *)(upcall_data ++ ->data)) ++ ->dict; ++ break; ++ case GF_UPCALL_RECALL_LEASE: ++ dict = ((struct gf_upcall_recall_lease *)(upcall_data->data)) ++ ->dict; ++ break; ++ } ++ if (dict) ++ dict_unref(dict); ++ ++ GF_FREE(upcall_data->client_uid); ++ GF_FREE(upcall_data->data); ++ } + GF_FREE(args); + return 0; + } +@@ -5727,14 +5747,7 @@ glfs_upcall_syncop_cbk(int ret, call_frame_t *frame, void *opaque) + { + struct upcall_syncop_args *args = opaque; + +- /* Here we not using upcall_syncop_args_free as application +- * will be cleaning up the args->up_arg using glfs_free +- * post processing upcall. +- */ +- if (ret) { +- upcall_syncop_args_free(args); +- } else +- GF_FREE(args); ++ (void)upcall_syncop_args_free(args); + + return 0; + } +@@ -5743,29 +5756,17 @@ static int + glfs_cbk_upcall_syncop(void *opaque) + { + struct upcall_syncop_args *args = opaque; ++ struct gf_upcall *upcall_data = NULL; + struct glfs_upcall *up_arg = NULL; + struct glfs *fs; ++ int ret = -1; + + fs = args->fs; +- up_arg = args->up_arg; +- +- if (fs->up_cbk && up_arg) { +- (fs->up_cbk)(up_arg, fs->up_data); +- return 0; +- } +- +- return -1; +-} ++ upcall_data = &args->upcall_data; + +-static struct upcall_syncop_args * +-upcall_syncop_args_init(struct glfs *fs, struct gf_upcall *upcall_data) +-{ +- struct upcall_syncop_args *args = NULL; +- int ret = -1; +- struct glfs_upcall *up_arg = NULL; +- +- if (!fs || !upcall_data) ++ if (!upcall_data) { + goto out; ++ } + + up_arg = GLFS_CALLOC(1, sizeof(struct gf_upcall), glfs_release_upcall, + glfs_mt_upcall_entry_t); +@@ -5795,6 +5796,8 @@ upcall_syncop_args_init(struct glfs *fs, struct gf_upcall *upcall_data) + if (up_arg->reason == GLFS_UPCALL_EVENT_NULL) { + gf_msg(THIS->name, GF_LOG_DEBUG, errno, API_MSG_INVALID_ENTRY, + "Upcall_EVENT_NULL received. Skipping it."); ++ ret = 0; ++ GLFS_FREE(up_arg); + goto out; + } else if (ret) { + gf_msg(THIS->name, GF_LOG_ERROR, errno, API_MSG_INVALID_ENTRY, +@@ -5802,6 +5805,85 @@ upcall_syncop_args_init(struct glfs *fs, struct gf_upcall *upcall_data) + goto out; + } + ++ if (fs->up_cbk && up_arg) ++ (fs->up_cbk)(up_arg, fs->up_data); ++ ++ /* application takes care of calling glfs_free on up_arg post ++ * their processing */ ++ ++out: ++ return ret; ++} ++ ++static struct gf_upcall_cache_invalidation * ++gf_copy_cache_invalidation(struct gf_upcall_cache_invalidation *src) ++{ ++ struct gf_upcall_cache_invalidation *dst = NULL; ++ ++ if (!src) ++ goto out; ++ ++ dst = GF_CALLOC(1, sizeof(struct gf_upcall_cache_invalidation), ++ glfs_mt_upcall_entry_t); ++ ++ if (!dst) { ++ gf_msg(THIS->name, GF_LOG_ERROR, ENOMEM, API_MSG_ALLOC_FAILED, ++ "Upcall entry allocation failed."); ++ goto out; ++ } ++ ++ dst->flags = src->flags; ++ dst->expire_time_attr = src->expire_time_attr; ++ dst->stat = src->stat; ++ dst->p_stat = src->p_stat; ++ dst->oldp_stat = src->oldp_stat; ++ ++ if (src->dict) ++ dst->dict = dict_copy_with_ref(src->dict, NULL); ++ ++ return dst; ++out: ++ return NULL; ++} ++ ++static struct gf_upcall_recall_lease * ++gf_copy_recall_lease(struct gf_upcall_recall_lease *src) ++{ ++ struct gf_upcall_recall_lease *dst = NULL; ++ ++ if (!src) ++ goto out; ++ ++ dst = GF_CALLOC(1, sizeof(struct gf_upcall_recall_lease), ++ glfs_mt_upcall_entry_t); ++ ++ if (!dst) { ++ gf_msg(THIS->name, GF_LOG_ERROR, ENOMEM, API_MSG_ALLOC_FAILED, ++ "Upcall entry allocation failed."); ++ goto out; ++ } ++ ++ dst->lease_type = src->lease_type; ++ memcpy(dst->tid, src->tid, 16); ++ ++ if (src->dict) ++ dst->dict = dict_copy_with_ref(src->dict, NULL); ++ ++ return dst; ++out: ++ return NULL; ++} ++ ++static struct upcall_syncop_args * ++upcall_syncop_args_init(struct glfs *fs, struct gf_upcall *upcall_data) ++{ ++ struct upcall_syncop_args *args = NULL; ++ int ret = -1; ++ struct gf_upcall *t_data = NULL; ++ ++ if (!fs || !upcall_data) ++ goto out; ++ + args = GF_CALLOC(1, sizeof(struct upcall_syncop_args), + glfs_mt_upcall_entry_t); + if (!args) { +@@ -5819,15 +5901,31 @@ upcall_syncop_args_init(struct glfs *fs, struct gf_upcall *upcall_data) + * notification without taking any lock/ref. + */ + args->fs = fs; +- args->up_arg = up_arg; ++ t_data = &(args->upcall_data); ++ t_data->client_uid = gf_strdup(upcall_data->client_uid); + +- /* application takes care of calling glfs_free on up_arg post +- * their processing */ ++ gf_uuid_copy(t_data->gfid, upcall_data->gfid); ++ t_data->event_type = upcall_data->event_type; ++ ++ switch (t_data->event_type) { ++ case GF_UPCALL_CACHE_INVALIDATION: ++ t_data->data = gf_copy_cache_invalidation( ++ (struct gf_upcall_cache_invalidation *)upcall_data->data); ++ break; ++ case GF_UPCALL_RECALL_LEASE: ++ t_data->data = gf_copy_recall_lease( ++ (struct gf_upcall_recall_lease *)upcall_data->data); ++ break; ++ } ++ ++ if (!t_data->data) ++ goto out; + + return args; + out: +- if (up_arg) { +- GLFS_FREE(up_arg); ++ if (ret) { ++ GF_FREE(args->upcall_data.client_uid); ++ GF_FREE(args); + } + + return NULL; +-- +1.8.3.1 + diff --git a/0265-fuse-add-missing-GF_FREE-to-fuse_interrupt.patch b/0265-fuse-add-missing-GF_FREE-to-fuse_interrupt.patch new file mode 100644 index 0000000..33663f0 --- /dev/null +++ b/0265-fuse-add-missing-GF_FREE-to-fuse_interrupt.patch @@ -0,0 +1,47 @@ +From 7455900798446681fea1a2693fac9b423ad9722a Mon Sep 17 00:00:00 2001 +From: Csaba Henk +Date: Tue, 9 Jul 2019 11:06:49 +0200 +Subject: [PATCH 265/265] fuse: add missing GF_FREE to fuse_interrupt + +Upstream: +(Reviewed on https://review.gluster.org/c/glusterfs/+/23016) +> Change-Id: Id7e003e4a53d0a0057c1c84e1cd704c80a6cb015 +> Fixes: bz#1728047 +> Signed-off-by: Csaba Henk + +BUG: 1734423 +Change-Id: I50640bf9b56349ab9b07140bdce8a45a7d07ba7a +Signed-off-by: Csaba Henk +Reviewed-on: https://code.engineering.redhat.com/gerrit/177298 +Tested-by: RHGS Build Bot +Reviewed-by: Sunil Kumar Heggodu Gopala Acharya +--- + xlators/mount/fuse/src/fuse-bridge.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c +index c05866b..1c946a2 100644 +--- a/xlators/mount/fuse/src/fuse-bridge.c ++++ b/xlators/mount/fuse/src/fuse-bridge.c +@@ -661,7 +661,7 @@ fuse_interrupt(xlator_t *this, fuse_in_header_t *finh, void *msg, + " failed to allocate timed message", + finh->unique, fii->unique); + +- return; ++ goto out; + } + + dmsg->fuse_out_header.unique = finh->unique; +@@ -673,6 +673,9 @@ fuse_interrupt(xlator_t *this, fuse_in_header_t *finh, void *msg, + + send_fuse_timed(this, dmsg); + } ++ ++out: ++ GF_FREE(finh); + } + + /* +-- +1.8.3.1 + diff --git a/glusterfs.spec b/glusterfs.spec index 05129e4..c0b799b 100644 --- a/glusterfs.spec +++ b/glusterfs.spec @@ -231,7 +231,7 @@ Release: 0.1%{?prereltag:.%{prereltag}}%{?dist} %else Name: glusterfs Version: 6.0 -Release: 10%{?dist} +Release: 11%{?dist} ExcludeArch: i686 %endif License: GPLv2 or LGPLv3+ @@ -571,6 +571,9 @@ Patch0259: 0259-gluster-block-tuning-perf-options.patch Patch0260: 0260-ctime-Set-mdata-xattr-on-legacy-files.patch Patch0261: 0261-features-utime-Fix-mem_put-crash.patch Patch0262: 0262-glusterd-ctime-Disable-ctime-by-default.patch +Patch0263: 0263-tests-fix-ctime-related-tests.patch +Patch0264: 0264-gfapi-Fix-deadlock-while-processing-upcall.patch +Patch0265: 0265-fuse-add-missing-GF_FREE-to-fuse_interrupt.patch %description GlusterFS is a distributed file-system capable of scaling to several @@ -2279,6 +2282,9 @@ fi %endif %changelog +* Tue Aug 06 2019 Sunil Kumar Acharya - 6.0-11 +- fixes bugs bz#1733520 bz#1734423 + * Fri Aug 02 2019 Sunil Kumar Acharya - 6.0-10 - fixes bugs bz#1713890