mirror of
https://github.com/ceph/ceph
synced 2025-02-22 02:27:29 +00:00
rbd-nbd: fix nbd do_unmap error handling
when nbd disconnect failed, ensure do_unmap return error logic. Signed-off-by: chenfangxian <chenfangxian@cmss.chinamobile.com> Signed-off-by: guojiannan <guojiannan@cmss.chinamobile.com>
This commit is contained in:
parent
f7187559af
commit
890adc605b
@ -776,19 +776,22 @@ close_ret:
|
||||
|
||||
static int do_unmap()
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
int nbd = open_device(devpath.c_str());
|
||||
if (nbd < 0) {
|
||||
cerr << "rbd-nbd: failed to open device: " << devpath << std::endl;
|
||||
return nbd;
|
||||
}
|
||||
|
||||
if (ioctl(nbd, NBD_DISCONNECT) < 0) {
|
||||
cerr << "rbd-nbd: the device is not used" << std::endl;
|
||||
r = ioctl(nbd, NBD_DISCONNECT);
|
||||
if (r < 0) {
|
||||
cerr << "rbd-nbd: the device is not used" << std::endl;
|
||||
}
|
||||
|
||||
close(nbd);
|
||||
|
||||
return 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
static int parse_imgpath(const std::string &imgpath)
|
||||
|
Loading…
Reference in New Issue
Block a user