|
|
a3470f |
From a7e4ed507c3332f896fb4822cfc3f98731c11785 Mon Sep 17 00:00:00 2001
|
|
|
a3470f |
From: Ravishankar N <ravishankar@redhat.com>
|
|
|
a3470f |
Date: Mon, 16 Apr 2018 15:38:34 +0530
|
|
|
a3470f |
Subject: [PATCH 228/236] afr: fixes to afr-eager locking
|
|
|
a3470f |
|
|
|
a3470f |
Upstream patch: https://review.gluster.org/#/c/19879/
|
|
|
a3470f |
|
|
|
a3470f |
1. If pre-op fails on all bricks,set lock->release to true in
|
|
|
a3470f |
afr_handle_lock_acquire_failure so that the GF_ASSERT in afr_unlock() does not
|
|
|
a3470f |
crash.
|
|
|
a3470f |
|
|
|
a3470f |
2. Added a missing 'return' after handling pre-op failure in
|
|
|
a3470f |
afr_transaction_perform_fop(), fixing a use-after-free issue.
|
|
|
a3470f |
|
|
|
a3470f |
Change-Id: If0627a9124cb5d6405037cab3f17f8325eed2d83
|
|
|
a3470f |
BUG: 1554291
|
|
|
a3470f |
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
|
|
|
a3470f |
Reviewed-on: https://code.engineering.redhat.com/gerrit/136228
|
|
|
a3470f |
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
|
|
|
a3470f |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
a3470f |
---
|
|
|
a3470f |
tests/bugs/replicate/bug-1561129-enospc.t | 24 ++++++++++++++++++++++++
|
|
|
a3470f |
xlators/cluster/afr/src/afr-transaction.c | 2 ++
|
|
|
a3470f |
2 files changed, 26 insertions(+)
|
|
|
a3470f |
create mode 100644 tests/bugs/replicate/bug-1561129-enospc.t
|
|
|
a3470f |
|
|
|
a3470f |
diff --git a/tests/bugs/replicate/bug-1561129-enospc.t b/tests/bugs/replicate/bug-1561129-enospc.t
|
|
|
a3470f |
new file mode 100644
|
|
|
a3470f |
index 0000000..1b402fc
|
|
|
a3470f |
--- /dev/null
|
|
|
a3470f |
+++ b/tests/bugs/replicate/bug-1561129-enospc.t
|
|
|
a3470f |
@@ -0,0 +1,24 @@
|
|
|
a3470f |
+#!/bin/bash
|
|
|
a3470f |
+#Tests that sequential write workload doesn't lead to FSYNCs
|
|
|
a3470f |
+
|
|
|
a3470f |
+. $(dirname $0)/../../include.rc
|
|
|
a3470f |
+. $(dirname $0)/../../volume.rc
|
|
|
a3470f |
+
|
|
|
a3470f |
+cleanup;
|
|
|
a3470f |
+
|
|
|
a3470f |
+TEST truncate -s 128M $B0/xfs_image
|
|
|
a3470f |
+TEST mkfs.xfs -f $B0/xfs_image
|
|
|
a3470f |
+TEST mkdir $B0/bricks
|
|
|
a3470f |
+TEST mount -t xfs -o loop $B0/xfs_image $B0/bricks
|
|
|
a3470f |
+
|
|
|
a3470f |
+TEST glusterd
|
|
|
a3470f |
+TEST pidof glusterd
|
|
|
a3470f |
+TEST $CLI volume create $V0 replica 3 $H0:$B0/bricks/brick{0,1,3}
|
|
|
a3470f |
+TEST $CLI volume start $V0
|
|
|
a3470f |
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0;
|
|
|
a3470f |
+
|
|
|
a3470f |
+# Write 50MB of data, which will try to consume 50x3=150MB on $B0/bricks.
|
|
|
a3470f |
+# Before that, we hit ENOSPC in pre-op cbk, which should not crash the mount.
|
|
|
a3470f |
+TEST ! dd if=/dev/zero of=$M0/a bs=1M count=50
|
|
|
a3470f |
+TEST stat $M0/a
|
|
|
a3470f |
+cleanup;
|
|
|
a3470f |
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
|
|
|
a3470f |
index 88dc821..0506a78 100644
|
|
|
a3470f |
--- a/xlators/cluster/afr/src/afr-transaction.c
|
|
|
a3470f |
+++ b/xlators/cluster/afr/src/afr-transaction.c
|
|
|
a3470f |
@@ -285,6 +285,7 @@ afr_handle_lock_acquire_failure (afr_local_t *local, gf_boolean_t locked)
|
|
|
a3470f |
INIT_LIST_HEAD (&shared);
|
|
|
a3470f |
LOCK (&local->inode->lock);
|
|
|
a3470f |
{
|
|
|
a3470f |
+ lock->release = _gf_true;
|
|
|
a3470f |
list_splice_init (&lock->waiting, &shared);
|
|
|
a3470f |
}
|
|
|
a3470f |
UNLOCK (&local->inode->lock);
|
|
|
a3470f |
@@ -510,6 +511,7 @@ afr_transaction_perform_fop (call_frame_t *frame, xlator_t *this)
|
|
|
a3470f |
priv->child_count);
|
|
|
a3470f |
if (failure_count == priv->child_count) {
|
|
|
a3470f |
afr_handle_lock_acquire_failure (local, _gf_true);
|
|
|
a3470f |
+ return 0;
|
|
|
a3470f |
} else {
|
|
|
a3470f |
lock = &local->inode_ctx->lock[local->transaction.type];
|
|
|
a3470f |
LOCK (&local->inode->lock);
|
|
|
a3470f |
--
|
|
|
a3470f |
1.8.3.1
|
|
|
a3470f |
|