From 086f99352cf8945515197997496c4822e6d51bf8 Mon Sep 17 00:00:00 2001 From: Xan Peng Date: Mon, 19 May 2014 09:39:00 -0600 Subject: [PATCH] Fix issue with dangling pointer in the rbd engine Without this patch, after _fio_rbd_connect() failed, fio will hang for a few seconds, display the following logs and then quit: ====console output start==== rbd_iodepth32: (g=0): rw=randwrite, bs=4K-4K/4K-4K/4K-4K, ioengine=rbd, iodepth=32 fio-2.1.9 Starting 1 process rbd engine: RBD version: 0.1.8 rbd engine: RBD version: 0.1.8 rbd_open failed. fio_rbd_connect failed. common/Mutex.cc: In function 'void Mutex::Lock(bool)' thread 7f6e337aa780 time 2014-05-17 19:23:23.417285 common/Mutex.cc: 93: FAILED assert(r == 0) ceph version 0.80 (b78644e) 1: (()+0x254093) [0x7f6e32502093] 2: (librados::RadosClient::shutdown()+0x1f) [0x7f6e324741df] 3: (rados_shutdown()+0x9) [0x7f6e32459209] 4: ./fio() [0x456a46] 5: (setup_files()+0xc2) [0x420872] 6: ./fio() [0x449c15] 7: (fio_backend()+0x115) [0x44a515] 8: (__libc_start_main()+0xf5) [0x7f6e311f3455] 9: ./fio() [0x40ad3c] NOTE: a copy of the executable, or objdump -rdS is needed to interpret this. terminate called after throwing an instance of 'ceph::FailedAssertion' Aborted ====console output end==== With this patch, after _fio_rbd_connect() failed, fio will quit at once: ====console output start==== rbd_iodepth32: (g=0): rw=randwrite, bs=4K-4K/4K-4K/4K-4K, ioengine=rbd, iodepth=32 fio-2.1.9 Starting 1 process rbd engine: RBD version: 0.1.8 rbd_open failed. fio_rbd_connect failed. Run status group 0 (all jobs): ====console output end==== Signed-off-by: Xan Peng Signed-off-by: Jens Axboe --- engines/rbd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engines/rbd.c b/engines/rbd.c index ff353737..dc6e7db6 100644 --- a/engines/rbd.c +++ b/engines/rbd.c @@ -131,8 +131,10 @@ static int _fio_rbd_connect(struct thread_data *td) failed_open: rados_ioctx_destroy(rbd_data->io_ctx); + rbd_data->io_ctx = NULL; failed_shutdown: rados_shutdown(rbd_data->cluster); + rbd_data->cluster = NULL; failed_early: return 1; } -- 2.25.1