From ab0e7cc0bec29bcc843dafcd82db21b6513f712d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 24 Feb 2017 02:08:17 +0000 Subject: [PATCH] scst_copy_mgr: Avoid that LUN removal triggers a BUG() Reported-by: Jinpu Wang git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7096 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_copy_mgr.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index f5935fdf8..5c9ce1345 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2522,9 +2522,8 @@ static bool scst_cm_is_lun_free(unsigned int lun) static unsigned int scst_cm_get_lun(const struct scst_device *dev) { - unsigned int res = -1; + unsigned int res = SCST_MAX_LUN; int i; - bool found = false; TRACE_ENTRY(); @@ -2538,7 +2537,6 @@ static unsigned int scst_cm_get_lun(const struct scst_device *dev) list_for_each_entry(tgt_dev, head, sess_tgt_dev_list_entry) { if (tgt_dev->dev == dev) { res = tgt_dev->lun; - found = true; TRACE_DBG("LUN %d found (full LUN %lld)", res, tgt_dev->lun); goto out; @@ -2546,8 +2544,6 @@ static unsigned int scst_cm_get_lun(const struct scst_device *dev) } } - sBUG_ON(!found); - out: TRACE_EXIT_RES(res); return res;