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