From a3328841eecb4b1a8b8aaf82d236a1dfb5546338 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 6 Sep 2019 03:40:24 +0000 Subject: [PATCH] scst_copy_mgr: Fix copy manager LUN wraparound (merge r8575 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@8576 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 ea482bbcf..200017150 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2594,8 +2594,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; }