Bug #4068
closedlibcephfs: if client->init() fails, shutdown() erroneously calls client->shutdown(), resulting in an assert being triggered
0%
Description
In src/libcephfs.cc mount() function:
if the client->init() call fails, shutdown() gets called. Assuming that the client variable is a valid object, shutdown calls client->shutdown().
client->shutdown() should not get called if client->init() failed because client->shutdown() asserts that init() succeeded. Consequently, we need a way to tell if client->init() succeeded independent of the object being valid.
The use case that uncovered this issue was attempting to issue a Hadoop command that uses libcephfs when the keyring was not accessible by the client (due to permissions issue on the file). At present, client->shutdown() being erroneously called results in a coredump that looks like this:
./osdc/ObjectCacher.h: In function 'void ObjectCacher::stop()' thread 7fe69b022700 time 2013-02-09 18:22:21.675116
./osdc/ObjectCacher.h: 496: FAILED assert(flusher_thread.is_started())
ceph version 0.56-698-g38dd59b (38dd59ba7cebe1941b864646246f98c75bb395c5)
1: (Client::shutdown()+0x392) [0x7fe689fa8f42]
2: (ceph_mount()+0x12b) [0x7fe689fa715b]
3: (Java_com_ceph_fs_CephMount_native_1ceph_1mount()+0xb7) [0x7fe68ac5a1e7]
4: [0x7fe690bfbd68]
NOTE: a copy of the executable, or `objdump -rdS <executable>` is needed to interpret this.
terminate called after throwing an instance of 'ceph::FailedAssertion'
Aborted (core dumped)
Ideally this scenario would log something reasonable and exit cleanly.