From 6aa0e72198e83d6dd849027fd3d0038037810065 Mon Sep 17 00:00:00 2001 From: Susant Palai Date: Tue, 16 Jun 2015 20:35:46 +0530 Subject: dht: block/handle create op falling to decommissioned brick Problem: Post remove-brick start till commit phase, the client layout may not be in sync with disk layout because of lack of lookup. Hence,a create call may fall on the decommissioned brick. Solution: Will acquire a lock on hashed subvol. So that a fix-layout or selfheal can not step on layout while reading the layout. Even if we read a layout before remove-brick fix-layout and the file falls on the decommissioned brick, the file should be migrated to a new brick as per the fix-layout. BUG: 1256283 Change-Id: I3ef1adaf20dfb9524396a3648d1a664464eda8c1 Signed-off-by: Susant Palai Reviewed-on: http://review.gluster.org/11260 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Raghavendra G Signed-off-by: Susant Palai Reviewed-on: http://review.gluster.org/12001 --- xlators/cluster/dht/src/dht-common.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'xlators/cluster/dht/src/dht-common.h') diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 5e86b32263c..f583d30599d 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -44,6 +44,10 @@ typedef int (*dht_selfheal_dir_cbk_t) (call_frame_t *frame, void *cookie, typedef int (*dht_defrag_cbk_fn_t) (xlator_t *this, xlator_t *dst_node, call_frame_t *frame); +typedef int (*dht_refresh_layout_unlock) (call_frame_t *frame, xlator_t *this, + int op_ret); + +typedef int (*dht_refresh_layout_done_handle) (call_frame_t *frame); struct dht_layout { int spread_cnt; /* layout spread count per directory, @@ -212,6 +216,10 @@ struct dht_local { gf_boolean_t force_mkdir; dht_layout_t *layout, *refreshed_layout; } selfheal; + + dht_refresh_layout_unlock refresh_layout_unlock; + dht_refresh_layout_done_handle refresh_layout_done; + uint32_t uid; uint32_t gid; @@ -510,6 +518,7 @@ typedef struct dht_migrate_info { GF_REF_DECL; } dht_migrate_info_t; + #define ENTRY_MISSING(op_ret, op_errno) (op_ret == -1 && op_errno == ENOENT) #define is_revalidate(loc) (dht_inode_ctx_layout_get (loc->inode, this, NULL) == 0) @@ -1067,4 +1076,6 @@ dht_layout_sort (dht_layout_t *layout); int dht_layout_missing_dirs (dht_layout_t *layout); +int +dht_refresh_layout (call_frame_t *frame); #endif/* _DHT_H */ -- cgit