summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-common.h
diff options
context:
space:
mode:
authorSakshi <sabansal@redhat.com>2015-07-16 14:31:03 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-04-06 03:08:06 -0700
commitb9c37234e0933c836e1bfdb72607b592ea5080c4 (patch)
treed2a2f859d4ef179ef28d3a772af1553306e2765b /xlators/cluster/dht/src/dht-common.h
parent5eabe98861d265abf4d82a783db0568e958ecdcd (diff)
dht: lock on subvols to prevent lookup vs rmdir race
There is a possibility that while an rmdir is completed on some non-hashed subvol and proceeding to others, a lookup selfheal can recreate the same directory on those subvols for which the rmdir had succeeded. Now the deletion of the parent directory will fail with an ENOTEMPTY. To fix this take blocking inodelk on the subvols before starting rmdir. Selfheal must also take blocking inodelk before creating the entry. Backport of http://review.gluster.org/13528 > Change-Id: I168a195c35ac1230ba7124d3b0ca157755b3df96 > BUG: 1245065 > Signed-off-by: Sakshi <sabansal@redhat.com> > Reviewed-on: http://review.gluster.org/13528 > CentOS-regression: Gluster Build System <jenkins@build.gluster.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Smoke: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Raghavendra G <rgowdapp@redhat.com> > Tested-by: Raghavendra G <rgowdapp@redhat.com> Change-Id: I168a195c35ac1230ba7124d3b0ca157755b3df96 BUG: 1257894 Signed-off-by: Sakshi <sabansal@redhat.com> Reviewed-on: http://review.gluster.org/13915 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.h')
-rw-r--r--xlators/cluster/dht/src/dht-common.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index edfb80566c0..d06224c6b68 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -50,7 +50,7 @@ typedef int (*dht_defrag_cbk_fn_t) (xlator_t *this, xlator_t *dst_node,
call_frame_t *frame, int ret);
typedef int (*dht_refresh_layout_unlock) (call_frame_t *frame, xlator_t *this,
- int op_ret);
+ int op_ret, int invoke_cbk);
typedef int (*dht_refresh_layout_done_handle) (call_frame_t *frame);
@@ -145,6 +145,11 @@ typedef enum {
qdstatfs_action_COMPARE,
} qdstatfs_action_t;
+typedef enum {
+ FAIL_ON_ANY_ERROR,
+ IGNORE_ENOENT_ESTALE
+} dht_reaction_type_t;
+
struct dht_skip_linkto_unlink {
gf_boolean_t handle_valid_link;
@@ -275,6 +280,7 @@ struct dht_local {
fop_inodelk_cbk_t inodelk_cbk;
dht_lock_t **locks;
int lk_count;
+ dht_reaction_type_t reaction;
/* whether locking failed on _any_ of the "locks" above */
int op_ret;
@@ -1132,7 +1138,8 @@ dht_nonblocking_inodelk (call_frame_t *frame, dht_lock_t **lk_array,
*/
int
dht_blocking_inodelk (call_frame_t *frame, dht_lock_t **lk_array,
- int lk_count, fop_inodelk_cbk_t inodelk_cbk);
+ int lk_count, dht_reaction_type_t reaction,
+ fop_inodelk_cbk_t inodelk_cbk);
int32_t
dht_unlock_inodelk (call_frame_t *frame, dht_lock_t **lk_array, int lk_count,