diff options
author | mav <mav@FreeBSD.org> | 2014-10-20 07:41:37 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2014-10-20 07:41:37 +0000 |
commit | b61a1b57066a1970646c5aaa2208f8d6ef5f387d (patch) | |
tree | cf99588a2d23350c68eae8dc499b27aa55565441 /usr.sbin/ctld | |
parent | db78e6d004fdce4ef766960eece656231d60e5b0 (diff) | |
download | FreeBSD-src-b61a1b57066a1970646c5aaa2208f8d6ef5f387d.zip FreeBSD-src-b61a1b57066a1970646c5aaa2208f8d6ef5f387d.tar.gz |
MFC r272911:
Make ctld start even if some LUNs are unable to open backing storage.
Such LUNs will be visible to initiators, but return "not ready" status
on media access commands. If backing storage become available later,
`ctladm modify ...` or `service ctld reload` can trigger its reopen.
Diffstat (limited to 'usr.sbin/ctld')
-rw-r--r-- | usr.sbin/ctld/kernel.c | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c index 5c5051f..9eeb500 100644 --- a/usr.sbin/ctld/kernel.c +++ b/usr.sbin/ctld/kernel.c @@ -700,20 +700,22 @@ kernel_lun_add(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN creation request: %s", - req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN creation error: %s", req.error_str); return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN creation request status %d", + case CTL_LUN_WARNING: + log_warnx("LUN creation warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN creation status: %d", req.status); return (1); } lun_set_ctl_lun(lun, req.reqdata.create.req_lun_id); - return (0); } @@ -735,14 +737,17 @@ kernel_lun_resize(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN modification request: %s", - req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN modification error: %s", req.error_str); return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN modification request status %d", + case CTL_LUN_WARNING: + log_warnx("LUN modification warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN modification status: %d", req.status); return (1); } @@ -767,14 +772,17 @@ kernel_lun_remove(struct lun *lun) return (1); } - if (req.status == CTL_LUN_ERROR) { - log_warnx("error returned from LUN removal request: %s", - req.error_str); + switch (req.status) { + case CTL_LUN_ERROR: + log_warnx("LUN removal error: %s", req.error_str); return (1); - } - - if (req.status != CTL_LUN_OK) { - log_warnx("unknown LUN removal request status %d", req.status); + case CTL_LUN_WARNING: + log_warnx("LUN removal warning: %s", req.error_str); + break; + case CTL_LUN_OK: + break; + default: + log_warnx("unknown LUN removal status: %d", req.status); return (1); } |