otherwise JournalingFileStore will assert when deleting FileJournal
which still has the non block/regular file opened.
Fixes: http://tracker.ceph.com/issues/17307
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit
7431eec6fd24cd08ca6c76a9893e3f6e8c63a916)
if (S_ISBLK(st.st_mode)) {
ret = _open_block_device();
- } else {
+ } else if (S_ISREG(st.st_mode)) {
if (aio && !force_aio) {
derr << "FileJournal::_open: disabling aio for non-block journal. Use "
<< "journal_force_aio to force use of aio anyway" << dendl;
aio = false;
}
ret = _open_file(st.st_size, st.st_blksize, create);
+ } else {
+ derr << "FileJournal::_open: wrong journal file type: " << st.st_mode
+ << dendl;
+ ret = -EINVAL;
}
if (ret)
out_fd:
VOID_TEMP_FAILURE_RETRY(::close(fd));
+ fd = -1;
return ret;
}