diff options
author | Sunny Kumar <sunkumar@redhat.com> | 2018-10-17 15:40:04 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2018-12-20 14:19:55 +0000 |
commit | 16fb69c519b3d61bf57065587439b4260b40291a (patch) | |
tree | 9fd90076a01e7c290dfb946bee5d8032afe70f72 | |
parent | 32f55a2708903145a51de5705ca8e60ff6dd6f9e (diff) |
shard: prevent segfault in shard_unlink_block_inode()
gluster-blockd sometimes segfaults with the following backtrace:
Core was generated by `/usr/sbin/gluster-blockd --glfs-lru-count 5 --log-level INFO'.
Program terminated with signal 11, Segmentation fault.
#0 0x00007fbb9cd639b9 in shard_unlink_block_inode (local=local@entry=0x7fbb80000a78, shard_block_num=<optimized out>) at shard.c:2929
2929 base_ictx->fsync_count--;
(gdb) bt
#0 0x00007fbb9cd639b9 in shard_unlink_block_inode (local=local@entry=0x7fbb80000a78, shard_block_num=<optimized out>) at shard.c:2929
#1 0x00007fbb9cd64311 in shard_unlink_shards_do_cbk (frame=frame@entry=0x7fbb9010a768, cookie=<optimized out>, this=<optimized out>, op_ret=<optimized out>, op_errno=<optimized out>, preparent=preparent@entry=0x7fbb7470dcf8,
postparent=postparent@entry=0x7fbb7470dd90, xdata=xdata@entry=0x0) at shard.c:2987
A fix for this has already been provided through a Converity report.
Backport of:
> Change-Id: Ic5d302a5e32d375acf8adc412763ab94e6dabc3d
> Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
> (cherry picked from commit 145e180517054626d07892219fdee689b703c218)
Change-Id: I699a039e9c5115eb3376190dd8014427d12a293b
Updates: bz#1659563
Signed-off-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r-- | xlators/features/shard/src/shard.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index 365147a3a95..ca91d4af65e 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -2926,7 +2926,8 @@ shard_unlink_block_inode(shard_local_t *local, int shard_block_num) list_del_init(&ctx->to_fsync_list); if (base_inode) __shard_inode_ctx_get(base_inode, this, &base_ictx); - base_ictx->fsync_count--; + if (base_ictx) + base_ictx->fsync_count--; } } UNLOCK(&inode->lock); |