diff options
author | Ravishankar N <ravishankar@redhat.com> | 2020-11-17 15:37:52 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-17 15:37:52 +0530 |
commit | ec023965a224b88f97c2c0e50015280393f76c5a (patch) | |
tree | 5c318068f8603385e1f94bd93a02ad53093893c7 | |
parent | 438fc46c0bef91019483962dfec56a5520158058 (diff) | |
download | glusterfs-ec023965a224b88f97c2c0e50015280393f76c5a.tar.gz glusterfs-ec023965a224b88f97c2c0e50015280393f76c5a.tar.xz glusterfs-ec023965a224b88f97c2c0e50015280393f76c5a.zip |
posix: fix io_uring crash in reconfigure (#1804)
Call posix_io_uring_fini only if it was inited to begin with.
Fixes: #1794
Reported-by: Mohit Agrawal <moagrawa@redhat.com>
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Change-Id: I0e840b6b1d1f26b104b30c8c4b88c14ce4aaac0d
-rw-r--r-- | tests/bugs/posix/posix-reconfigure-uring-crash.t | 20 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix-io-uring.c | 5 |
2 files changed, 24 insertions, 1 deletions
diff --git a/tests/bugs/posix/posix-reconfigure-uring-crash.t b/tests/bugs/posix/posix-reconfigure-uring-crash.t new file mode 100644 index 0000000000..dd28fa9e14 --- /dev/null +++ b/tests/bugs/posix/posix-reconfigure-uring-crash.t @@ -0,0 +1,20 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0..2}; +TEST $CLI volume start $V0 +EXPECT 'Started' volinfo_field $V0 'Status'; +TEST $CLI volume add-brick $V0 replica 3 $H0:$B0/${V0}{3..5} +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}3 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}4 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}5 +cleanup; diff --git a/xlators/storage/posix/src/posix-io-uring.c b/xlators/storage/posix/src/posix-io-uring.c index 567a6a83ef..3671548d05 100644 --- a/xlators/storage/posix/src/posix-io-uring.c +++ b/xlators/storage/posix/src/posix-io-uring.c @@ -606,10 +606,13 @@ posix_io_uring_on(xlator_t *this) int posix_io_uring_off(xlator_t *this) { + struct posix_private *priv = this->private; + this->fops->readv = posix_readv; this->fops->writev = posix_writev; this->fops->fsync = posix_fsync; - posix_io_uring_fini(this); + if (priv->io_uring_capable) + posix_io_uring_fini(this); return 0; } |