summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2015-04-01 14:04:36 +0530
committerVijay Bellur <vbellur@redhat.com>2015-04-03 06:33:59 -0700
commit5599165e09e5c5e2862996b5f92cf1a1227b9039 (patch)
tree32dfb18339294e04048c25bac428e271f11ccf5d /xlators
parent00d4125a5cb7102efeb23873cbaf155a71faa9dd (diff)
features/shard: Fail writes if /.shard already exists as a file
Change-Id: Id7250ca4637c37a005cf2def43d5b843c1ea6562 BUG: 1205661 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/10094 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/shard/src/shard.c8
1 files changed, 8 insertions, 0 deletions
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;