Project

General

Profile

Bug #19086

BlockDevice::create should add check for readlink result instead of raise error until add_block_content

Added by Ji You about 7 years ago. Updated almost 7 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
-
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(RADOS):
BlueStore
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

BlockDevice *BlockDevice::create(CephContext* cct, const string& path,
                 aio_callback_t cb, void *cbpriv)
{
  string type = "kernel";
  char buf[PATH_MAX + 1];
  int r = ::readlink(path.c_str(), buf, sizeof(buf) - 1);
  if (r >= 0) {
    buf[r] = '\0';
    char *bname = ::basename(buf);
    if (strncmp(bname, SPDK_PREFIX, sizeof(SPDK_PREFIX)-1) == 0)
      type = "ust-nvme";
  }
  dout(1) << __func__ << " path " << path << " type " << type << dendl;

  if (type == "kernel") {
    return new KernelDevice(cct, cb, cbpriv);
  }
#if defined(HAVE_SPDK)
  if (type == "ust-nvme") {
    return new NVMEDevice(cct, cb, cbpriv);
  }
#endif

  derr << __func__ << " unknown backend " << type << dendl;
  ceph_abort();
  return NULL;
}

Add assert here to check the file exits. Other wise would raise error until operation on the Device.

#0  0x00007f26faf451fb in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:37
#1  0x00007f26fb432e15 in reraise_fatal (signum=6) at /var/www/ceph/src/global/signal_handler.cc:74
#2  handle_fatal_signal (signum=6) at /var/www/ceph/src/global/signal_handler.cc:138
#3  <signal handler called>
#4  0x00007f26f1236c37 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f26f123a028 in __GI_abort () at abort.c:89
#6  0x00007f26f2295850 in ceph::__ceph_assert_fail (assertion=assertion@entry=0x7f26fb43b1a9 "bdev[id]",
    file=file@entry=0x7f26fb43a8a0 "/var/www/ceph/src/os/bluestore/BlueFS.cc", line=line@entry=157,
    func=func@entry=0x7f26fb43cda0 <BlueFS::add_block_extent(unsigned int, unsigned long, unsigned long)::__PRETTY_FUNCTION__> "void BlueFS::add_block_extent(unsigned int, uint64_t, uint64_t)") at /var/www/ceph/src/common/assert.cc:77
#7  0x00007f26fb3f7ca2 in BlueFS::add_block_extent (this=0x7fffb42827a0, id=1, offset=1048576, length=133169152) at /var/www/ceph/src/os/bluestore/BlueFS.cc:157

History

#2 Updated by Shinobu Kinjo about 7 years ago

  • Status changed from New to Need More Info

#3 Updated by Sage Weil almost 7 years ago

  • Status changed from Need More Info to Rejected

#4 Updated by Greg Farnum almost 7 years ago

  • Project changed from Ceph to RADOS
  • Category deleted (107)

#5 Updated by Greg Farnum almost 7 years ago

  • Component(RADOS) BlueStore added

Also available in: Atom PDF