From 01acebdbb7897c57a5437771f16d3066432e39dc Mon Sep 17 00:00:00 2001 From: trasz Date: Fri, 13 Dec 2013 21:22:12 +0000 Subject: [PATCH] MFC r258871: Properly report an error instead of panicing when user tries to create LUN backed by non-disk device, e.g. /dev/null. Approved by: re (glebius) Sponsored by: The FreeBSD Foundation git-svn-id: svn://svn.freebsd.org/base/releng/10.0@259332 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/cam/ctl/ctl_backend_block.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index d2d42876..18c5c28c 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -1485,6 +1485,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; @@ -1503,6 +1504,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; @@ -1589,7 +1591,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); -- 2.42.0