From 5599165e09e5c5e2862996b5f92cf1a1227b9039 Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Wed, 1 Apr 2015 14:04:36 +0530 Subject: features/shard: Fail writes if /.shard already exists as a file Change-Id: Id7250ca4637c37a005cf2def43d5b843c1ea6562 BUG: 1205661 Signed-off-by: Krutika Dhananjay Reviewed-on: http://review.gluster.org/10094 Reviewed-by: Pranith Kumar Karampuri Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/features/shard/src/shard.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'xlators') diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index 696032f4bac..29e131080f6 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -1238,6 +1238,14 @@ shard_lookup_dot_shard_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret) goto unwind; + if (!IA_ISDIR (buf->ia_type)) { + gf_log (this->name, GF_LOG_CRITICAL, "/.shard already exists " + "and is not a directory. Please remove /.shard from all" + " bricks and try again"); + op_errno = EIO; + goto unwind; + } + shard_link_dot_shard_inode (local, inode, buf); shard_writev_create_write_shards (frame, this); return 0; -- cgit