From d46632247cbbeefb4798512e4426943f9768ecbf Mon Sep 17 00:00:00 2001 From: Krutika Dhananjay Date: Thu, 2 Aug 2018 21:48:34 +0530 Subject: 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 --- xlators/features/shard/src/shard.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'xlators/features/shard') 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; -- cgit