From 2379475bda40de6349e94506e0c7ea9386c9b514 Mon Sep 17 00:00:00 2001 From: Kaushal M Date: Mon, 31 Oct 2011 12:33:50 +0530 Subject: cluster/afr : Fix self-heal of special files Fixes self-heal of special files like device files, fifo files, socket files etc. Does it by doing the following: * Prevent setting of pending data xattr on a special file during entry self-heal when a new file is created. * Allow data self-heal to be started on all file types other than directories. During data self-heal, for special files just erase pending xattrs, if those xattrs were set by previous releases of glusterfs. Change-Id: I1a36670b7287292d579b53852e25cdd452d55605 BUG: 3525 Reviewed-on: http://review.gluster.com/647 Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- xlators/cluster/afr/src/afr-self-heal-entry.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'xlators/cluster/afr/src/afr-self-heal-entry.c') diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index e32b507631a..21b248f496c 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -1097,14 +1097,19 @@ afr_sh_entry_impunge_newfile_cbk (call_frame_t *impunge_frame, void *cookie, gf_log (this->name, GF_LOG_ERROR, "Out of memory"); goto out; } + /* Pending data xattrs shouldn't be set for special files + */ idx = afr_index_for_transaction_type (AFR_METADATA_TRANSACTION); pending_array[idx] = hton32 (1); if (IA_ISDIR (stbuf->ia_type)) idx = afr_index_for_transaction_type (AFR_ENTRY_TRANSACTION); - else + else if (IA_ISREG (stbuf->ia_type)) idx = afr_index_for_transaction_type (AFR_DATA_TRANSACTION); + else + goto cont; pending_array[idx] = hton32 (1); +cont: ret = dict_set_dynptr (xattr, priv->pending_key[child_index], pending_array, 3 * sizeof (int32_t)); if (ret < 0) { -- cgit