Skip to content

Commit

Permalink
Merge pull request #12956 from liuhongtong/wip-nvmedevice
Browse files Browse the repository at this point in the history
os/bluestore: fix NVMEDevice::open failure if serial number ends with a …

Reviewed-by: Haomai Wang <haomai@xsky.com>
Reviewed-by: Pan liu <liupan1111@gmail.com>
Reviewed-by: Igor Fedotov <ifedotov@mirantis.com>
  • Loading branch information
yuyuyu101 committed Jan 24, 2017
2 parents 8558a0f + 97aa6ec commit b2df030
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/os/bluestore/NVMEDevice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ void SharedDriverData::_aio_thread()
data_buf_reset_sgl, data_buf_next_sge);
if (r < 0) {
t->ctx->nvme_task_first = t->ctx->nvme_task_last = nullptr;
t->release_segs();
delete t;
derr << __func__ << " failed to do write command" << dendl;
ceph_abort();
Expand Down Expand Up @@ -798,10 +799,12 @@ int NVMEDevice::open(const string& p)
derr << __func__ << " unable to read " << p << ": " << cpp_strerror(r) << dendl;
return r;
}
while (r > 0 && !isalpha(buf[r-1])) {
--r;
/* scan buf from the beginning with isxdigit. */
int i = 0;
while (i < r && isxdigit(buf[i])) {
i++;
}
serial_number = string(buf, r);
serial_number = string(buf, i);
r = manager.try_get(serial_number, &driver);
if (r < 0) {
derr << __func__ << " failed to get nvme device with sn " << serial_number << dendl;
Expand Down

0 comments on commit b2df030

Please sign in to comment.