|
|
e7a346 |
From fef5fb73545bed5a4040db1f8e4e855286c1981d Mon Sep 17 00:00:00 2001
|
|
|
e7a346 |
From: Ravishankar N <ravishankar@redhat.com>
|
|
|
e7a346 |
Date: Wed, 18 Jul 2018 14:16:46 +0530
|
|
|
e7a346 |
Subject: [PATCH 327/333] afr: switch lk_owner only when pre-op succeeds
|
|
|
e7a346 |
|
|
|
e7a346 |
Backport of https://review.gluster.org/#/c/20527/
|
|
|
e7a346 |
|
|
|
e7a346 |
Problem:
|
|
|
e7a346 |
In a disk full scenario, we take a failure path in afr_transaction_perform_fop()
|
|
|
e7a346 |
and go to unlock phase. But we change the lk-owner before that, causing unlock
|
|
|
e7a346 |
to fail. When mount issues another fop that takes locks on that file, it hangs.
|
|
|
e7a346 |
|
|
|
e7a346 |
Fix:
|
|
|
e7a346 |
Change lk-owner only when we are about to perform the fop phase.
|
|
|
e7a346 |
Also fix the same issue for arbiters when afr_txn_arbitrate_fop() fails the fop.
|
|
|
e7a346 |
|
|
|
e7a346 |
Also removed the DISK_SPACE_CHECK_AND_GOTO in posix_xattrop. Otherwise truncate
|
|
|
e7a346 |
to zero will fail pre-op phase with ENOSPC when the user is actually trying to
|
|
|
e7a346 |
freee up space.
|
|
|
e7a346 |
|
|
|
e7a346 |
Change-Id: I8663003fa7d472e93fe61cc1e39c78084d3de81f
|
|
|
e7a346 |
BUG: 1599998
|
|
|
e7a346 |
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
|
|
|
e7a346 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/144275
|
|
|
e7a346 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e7a346 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
e7a346 |
---
|
|
|
e7a346 |
xlators/cluster/afr/src/afr-transaction.c | 20 ++++++++++----------
|
|
|
e7a346 |
xlators/storage/posix/src/posix.c | 5 -----
|
|
|
e7a346 |
2 files changed, 10 insertions(+), 15 deletions(-)
|
|
|
e7a346 |
|
|
|
e7a346 |
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
|
|
|
e7a346 |
index 321b6f1..3f55070 100644
|
|
|
e7a346 |
--- a/xlators/cluster/afr/src/afr-transaction.c
|
|
|
e7a346 |
+++ b/xlators/cluster/afr/src/afr-transaction.c
|
|
|
e7a346 |
@@ -495,11 +495,10 @@ afr_txn_arbitrate_fop (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
local->op_errno = ENOTCONN;
|
|
|
e7a346 |
for (i = 0; i < priv->child_count; i++)
|
|
|
e7a346 |
local->transaction.failed_subvols[i] = 1;
|
|
|
e7a346 |
- afr_changelog_post_op (frame, this);/*uninherit should happen*/
|
|
|
e7a346 |
- } else {
|
|
|
e7a346 |
- afr_transaction_fop (frame, this);
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
+ afr_transaction_fop (frame, this);
|
|
|
e7a346 |
+
|
|
|
e7a346 |
return;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
@@ -529,13 +528,6 @@ afr_transaction_perform_fop (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
local->transaction.failed_subvols[i] = 1;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
- /* Perform fops with the lk-owner from top xlator.
|
|
|
e7a346 |
- * Eg: lk-owner of posix-lk and flush should be same,
|
|
|
e7a346 |
- * flush cant clear the posix-lks without that lk-owner.
|
|
|
e7a346 |
- */
|
|
|
e7a346 |
- afr_save_lk_owner (frame);
|
|
|
e7a346 |
- frame->root->lk_owner =
|
|
|
e7a346 |
- local->transaction.main_frame->root->lk_owner;
|
|
|
e7a346 |
|
|
|
e7a346 |
if (local->pre_op_compat)
|
|
|
e7a346 |
/* old mode, pre-op was done as afr_changelog_do()
|
|
|
e7a346 |
@@ -561,6 +553,14 @@ afr_transaction_perform_fop (call_frame_t *frame, xlator_t *this)
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
fop:
|
|
|
e7a346 |
+ /* Perform fops with the lk-owner from top xlator.
|
|
|
e7a346 |
+ * Eg: lk-owner of posix-lk and flush should be same,
|
|
|
e7a346 |
+ * flush cant clear the posix-lks without that lk-owner.
|
|
|
e7a346 |
+ */
|
|
|
e7a346 |
+ afr_save_lk_owner (frame);
|
|
|
e7a346 |
+ frame->root->lk_owner =
|
|
|
e7a346 |
+ local->transaction.main_frame->root->lk_owner;
|
|
|
e7a346 |
+
|
|
|
e7a346 |
if (priv->arbiter_count == 1) {
|
|
|
e7a346 |
afr_txn_arbitrate_fop (frame, this);
|
|
|
e7a346 |
} else {
|
|
|
e7a346 |
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
|
|
|
e7a346 |
index 01f472b..ddb875c 100644
|
|
|
e7a346 |
--- a/xlators/storage/posix/src/posix.c
|
|
|
e7a346 |
+++ b/xlators/storage/posix/src/posix.c
|
|
|
e7a346 |
@@ -6147,16 +6147,11 @@ do_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
|
|
|
e7a346 |
dict_t *xattr_rsp = NULL;
|
|
|
e7a346 |
dict_t *xdata_rsp = NULL;
|
|
|
e7a346 |
struct iatt stbuf = {0};
|
|
|
e7a346 |
- struct posix_private *priv = NULL;
|
|
|
e7a346 |
-
|
|
|
e7a346 |
|
|
|
e7a346 |
VALIDATE_OR_GOTO (frame, out);
|
|
|
e7a346 |
VALIDATE_OR_GOTO (xattr, out);
|
|
|
e7a346 |
VALIDATE_OR_GOTO (this, out);
|
|
|
e7a346 |
|
|
|
e7a346 |
- priv = this->private;
|
|
|
e7a346 |
- DISK_SPACE_CHECK_AND_GOTO (frame, priv, xdata, op_ret, op_errno, out);
|
|
|
e7a346 |
-
|
|
|
e7a346 |
if (fd) {
|
|
|
e7a346 |
op_ret = posix_fd_ctx_get (fd, this, &pfd, &op_errno);
|
|
|
e7a346 |
if (op_ret < 0) {
|
|
|
e7a346 |
--
|
|
|
e7a346 |
1.8.3.1
|
|
|
e7a346 |
|