|
|
74096c |
From 40519185067d891f06818c574301ea1af4b36479 Mon Sep 17 00:00:00 2001
|
|
|
74096c |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
74096c |
Date: Wed, 17 Jun 2020 10:45:19 +0530
|
|
|
74096c |
Subject: [PATCH 476/478] mount/fuse: use cookies to get fuse-interrupt-record
|
|
|
74096c |
instead of xdata
|
|
|
74096c |
|
|
|
74096c |
Problem:
|
|
|
74096c |
On executing tests/features/flock_interrupt.t the following error log
|
|
|
74096c |
appears
|
|
|
74096c |
[2020-06-16 11:51:54.631072 +0000] E
|
|
|
74096c |
[fuse-bridge.c:4791:fuse_setlk_interrupt_handler_cbk] 0-glusterfs-fuse:
|
|
|
74096c |
interrupt record not found
|
|
|
74096c |
|
|
|
74096c |
This happens because fuse-interrupt-record is never sent on the wire by
|
|
|
74096c |
getxattr fop and there is no guarantee that in the cbk it will be
|
|
|
74096c |
available in case of failures.
|
|
|
74096c |
|
|
|
74096c |
Fix:
|
|
|
74096c |
wind getxattr fop with fuse-interrupt-record as cookie and recover it
|
|
|
74096c |
in the cbk
|
|
|
74096c |
|
|
|
74096c |
Upstream:
|
|
|
74096c |
> Reviewed-on: https://review.gluster.org/24588
|
|
|
74096c |
> Fixes: #1310
|
|
|
74096c |
> Change-Id: I4cfff154321a449114fc26e9440db0f08e5c7daa
|
|
|
74096c |
> Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
74096c |
|
|
|
74096c |
BUG: 1821743
|
|
|
74096c |
Change-Id: If9576801654d4d743bd66ae90ca259c4d34746a7
|
|
|
74096c |
Signed-off-by: Csaba Henk <csaba@redhat.com>
|
|
|
74096c |
Reviewed-on: https://code.engineering.redhat.com/gerrit/216159
|
|
|
74096c |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
74096c |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
74096c |
---
|
|
|
74096c |
tests/features/flock_interrupt.t | 1 -
|
|
|
74096c |
xlators/mount/fuse/src/fuse-bridge.c | 28 +++++++---------------------
|
|
|
74096c |
2 files changed, 7 insertions(+), 22 deletions(-)
|
|
|
74096c |
|
|
|
74096c |
diff --git a/tests/features/flock_interrupt.t b/tests/features/flock_interrupt.t
|
|
|
74096c |
index 964a4bc..b8717e3 100644
|
|
|
74096c |
--- a/tests/features/flock_interrupt.t
|
|
|
74096c |
+++ b/tests/features/flock_interrupt.t
|
|
|
74096c |
@@ -28,6 +28,5 @@ flock $M0/testfile sleep 6 & { sleep 0.3; flock -w 2 $M0/testfile true; echo ok
|
|
|
74096c |
EXPECT_WITHIN 4 ok cat got_lock;
|
|
|
74096c |
|
|
|
74096c |
## Finish up
|
|
|
74096c |
-sleep 7;
|
|
|
74096c |
rm -f got_lock;
|
|
|
74096c |
cleanup;
|
|
|
74096c |
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
|
|
|
74096c |
index f61fa39..1bddac2 100644
|
|
|
74096c |
--- a/xlators/mount/fuse/src/fuse-bridge.c
|
|
|
74096c |
+++ b/xlators/mount/fuse/src/fuse-bridge.c
|
|
|
74096c |
@@ -4768,16 +4768,8 @@ fuse_setlk_interrupt_handler_cbk(call_frame_t *frame, void *cookie,
|
|
|
74096c |
int32_t op_errno, dict_t *dict, dict_t *xdata)
|
|
|
74096c |
{
|
|
|
74096c |
fuse_interrupt_state_t intstat = INTERRUPT_NONE;
|
|
|
74096c |
- fuse_interrupt_record_t *fir;
|
|
|
74096c |
+ fuse_interrupt_record_t *fir = cookie;
|
|
|
74096c |
fuse_state_t *state = NULL;
|
|
|
74096c |
- int ret = 0;
|
|
|
74096c |
-
|
|
|
74096c |
- ret = dict_get_bin(xdata, "fuse-interrupt-record", (void **)&fir;;
|
|
|
74096c |
- if (ret < 0) {
|
|
|
74096c |
- gf_log("glusterfs-fuse", GF_LOG_ERROR, "interrupt record not found");
|
|
|
74096c |
-
|
|
|
74096c |
- goto out;
|
|
|
74096c |
- }
|
|
|
74096c |
|
|
|
74096c |
intstat = op_ret >= 0 ? INTERRUPT_HANDLED : INTERRUPT_SQUELCHED;
|
|
|
74096c |
|
|
|
74096c |
@@ -4789,7 +4781,6 @@ fuse_setlk_interrupt_handler_cbk(call_frame_t *frame, void *cookie,
|
|
|
74096c |
GF_FREE(state);
|
|
|
74096c |
}
|
|
|
74096c |
|
|
|
74096c |
-out:
|
|
|
74096c |
STACK_DESTROY(frame->root);
|
|
|
74096c |
|
|
|
74096c |
return 0;
|
|
|
74096c |
@@ -4827,9 +4818,10 @@ fuse_setlk_interrupt_handler(xlator_t *this, fuse_interrupt_record_t *fir)
|
|
|
74096c |
frame->op = GF_FOP_GETXATTR;
|
|
|
74096c |
state->name = xattr_name;
|
|
|
74096c |
|
|
|
74096c |
- STACK_WIND(frame, fuse_setlk_interrupt_handler_cbk, state->active_subvol,
|
|
|
74096c |
- state->active_subvol->fops->fgetxattr, state->fd, xattr_name,
|
|
|
74096c |
- state->xdata);
|
|
|
74096c |
+ STACK_WIND_COOKIE(frame, fuse_setlk_interrupt_handler_cbk, fir,
|
|
|
74096c |
+ state->active_subvol,
|
|
|
74096c |
+ state->active_subvol->fops->fgetxattr, state->fd,
|
|
|
74096c |
+ xattr_name, state->xdata);
|
|
|
74096c |
|
|
|
74096c |
return;
|
|
|
74096c |
|
|
|
74096c |
@@ -4852,15 +4844,9 @@ fuse_setlk_resume(fuse_state_t *state)
|
|
|
74096c |
fir = fuse_interrupt_record_new(state->finh, fuse_setlk_interrupt_handler);
|
|
|
74096c |
state_clone = gf_memdup(state, sizeof(*state));
|
|
|
74096c |
if (state_clone) {
|
|
|
74096c |
- /*
|
|
|
74096c |
- * Calling this allocator with fir casted to (char *) seems like
|
|
|
74096c |
- * an abuse of this API, but in fact the API is stupid to assume
|
|
|
74096c |
- * a (char *) argument (in the funcion it's casted to (void *)
|
|
|
74096c |
- * anyway).
|
|
|
74096c |
- */
|
|
|
74096c |
- state_clone->xdata = dict_for_key_value(
|
|
|
74096c |
- "fuse-interrupt-record", (char *)fir, sizeof(*fir), _gf_true);
|
|
|
74096c |
+ state_clone->xdata = dict_new();
|
|
|
74096c |
}
|
|
|
74096c |
+
|
|
|
74096c |
if (!fir || !state_clone || !state_clone->xdata) {
|
|
|
74096c |
if (fir) {
|
|
|
74096c |
GF_FREE(fir);
|
|
|
74096c |
--
|
|
|
74096c |
1.8.3.1
|
|
|
74096c |
|