summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2018-08-02 21:48:34 +0530
committerKrutika Dhananjay <kdhananj@redhat.com>2018-08-14 13:49:42 +0000
commitd46632247cbbeefb4798512e4426943f9768ecbf (patch)
tree1b32f90cc7ddd68eb63b932ca086c3e7720489f0 /xlators
parent76fcdc2a18311ece1ba0d2a191c9d3261637d41c (diff)
features/shard: Fix crash and test case in RENAME fop
Setting the refresh flag in inode ctx in shard_rename_src_cbk() is applicable only when the dst file exists and is sharded and has a hard link > 1 at the time of rename. But this piece of code is exercised even when dst doesn't exist. In this case, the mount crashes because local->int_inodelk.loc.inode is NULL. Change-Id: Iaf85a5ee3dff8b01a76e11972f10f2bb9dcbd407 Updates: bz#1611692 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/shard/src/shard.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index 2e76720d176..45711754ebe 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -4325,9 +4325,12 @@ shard_rename_src_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
/* Set ctx->refresh to TRUE to force a lookup on disk when
* shard_lookup_base_file() is called next to refresh the hard link
- * count in ctx
+ * count in ctx. Note that this is applicable only to the case where
+ * the rename dst is already existent and sharded.
*/
- shard_inode_ctx_set_refresh_flag (local->int_inodelk.loc.inode, this);
+ if ((local->dst_block_size) && (!local->cleanup_required))
+ shard_inode_ctx_set_refresh_flag (local->int_inodelk.loc.inode,
+ this);
local->prebuf = *buf;
local->preoldparent = *preoldparent;