Properly report an error instead of panicing when user tries to create
LUN backed by non-disk device, e.g. /dev/null. Reviewed by: ken (earlier version) MFC after: 3 days Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
aaed7cd3d5
commit
0cd85d010b
@ -1483,6 +1483,7 @@ ctl_be_block_close(struct ctl_be_block_lun *be_lun)
|
||||
case CTL_BE_BLOCK_FILE:
|
||||
break;
|
||||
case CTL_BE_BLOCK_NONE:
|
||||
break;
|
||||
default:
|
||||
panic("Unexpected backend type.");
|
||||
break;
|
||||
@ -1501,6 +1502,7 @@ ctl_be_block_close(struct ctl_be_block_lun *be_lun)
|
||||
}
|
||||
break;
|
||||
case CTL_BE_BLOCK_NONE:
|
||||
break;
|
||||
default:
|
||||
panic("Unexpected backend type.");
|
||||
break;
|
||||
@ -1587,7 +1589,7 @@ ctl_be_block_open(struct ctl_be_block_softc *softc,
|
||||
} else {
|
||||
error = EINVAL;
|
||||
snprintf(req->error_str, sizeof(req->error_str),
|
||||
"%s is not a disk or file", be_lun->dev_path);
|
||||
"%s is not a disk or plain file", be_lun->dev_path);
|
||||
}
|
||||
VOP_UNLOCK(be_lun->vn, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user