From 410c4624050cdf8c77f976ad4af9326b11cac788 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 6 Sep 2019 03:38:38 +0000 Subject: [PATCH] scst_copy_mgr: Fix copy manager LUN wraparound This patch has been provided by Alexander Sinditskiy. See also https://sourceforge.net/p/scst/tickets/27/. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8575 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_copy_mgr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index bbeec43b7..2fe02a287 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2582,8 +2582,10 @@ static int scst_cm_dev_register(struct scst_device *dev, uint64_t lun) add_lun = true; while (1) { lun = scst_cm_next_lun++; - if (lun == SCST_MAX_LUN) + if (lun == SCST_MAX_LUN) { + scst_cm_next_lun = 0; continue; + } if (scst_cm_is_lun_free(lun)) break; }