[sheepdog] [PATCH] sheep: fix default_link on EEXIST of link

Liu Yuan namei.unix at gmail.com
Wed Jun 19 10:10:38 CEST 2013


This is observed by the following bug:

Jun 18 21:55:11 [rw] default_link(377) failed to link from
/mnt/ST2000DM001-1CH164_W1E2N5GM/obj/.stale/0002e519000054f1.21 to
/mnt/ST2000DM001-1CH164_W1E2N5GM/obj/0002e519000054f1, File exists
Jun 18 21:55:11 [rw] err_to_sderr(96) oid=2e519000054f1, File exists
Jun 18 21:55:11 [main] remove_disk(319) /mnt/ST2000DM001-1CH164_W1E2N5GM/obj from multi-disk array

Reported-by: Valerio Pachera <sirio81 at gmail.com>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheep/plain_store.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index f5059a3..5c3e275 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -373,11 +373,14 @@ int default_link(uint64_t oid, uint32_t tgt_epoch)
 	get_stale_obj_path(oid, tgt_epoch, stale_path);
 
 	if (link(stale_path, path) < 0) {
+		if (errno == EEXIST)
+			goto out;
+
 		sd_eprintf("failed to link from %s to %s, %m", stale_path,
 			   path);
 		return err_to_sderr(path, oid, errno);
 	}
-
+out:
 	return SD_RES_SUCCESS;
 }
 
-- 
1.7.9.5




More information about the sheepdog mailing list