From c522f2448ddd8d36f83dffb236b1855c6ad53036 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 9 Feb 2021 03:37:28 +0000 Subject: [PATCH 1/2] scst: Increase the maximum READ CAPACITY(16) response buffer size From the libiscsi source code: readcapacity16(sd, &rc16_task, /*alloc_len=*/96, EXPECT_STATUS_GOOD); Hence increase the limit from 32 to 128. Fixes: dd467b0eda12 ("scst: Limit the size of READ CAPACITY buffers") git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9340 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 1f7f78179..bfcec05f7 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -11216,7 +11216,7 @@ static int get_cdb_info_serv_act_in(struct scst_cmd *cmd, SCST_REG_RESERVE_ALLOWED | SCST_WRITE_EXCL_ALLOWED | SCST_EXCL_ACCESS_ALLOWED; - cmd->log2_max_buf_len = 5; + cmd->log2_max_buf_len = 7; break; case SAI_GET_LBA_STATUS: cmd->op_name = "GET LBA STATUS"; From eb34335f2fead86c4f877a1aef5b3c2180ec7946 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 9 Feb 2021 03:42:26 +0000 Subject: [PATCH 2/2] scst: Suppress a warning in scst_cm_update_dev() Suppress the following warning: WARNING: CPU: 0 PID: 6998 at scst/src/scst_copy_mgr.c:2672 scst_cm_update_dev+0xdc/0x110 This warning can be triggered during unregistration of a virtual device with the following test case: 1. Change a parameter of the virtual device, e.g. the USN. 2. Delete the LUN. That triggers the following sequence: 1. vdev_del_device() 2. scst_unregister_virtual_device() 3. scst_acg_del_lun() 4. cancel the work struct associated with vdev_inq_changed_fn(). 5. visk_detach() 6. vdev_del_device() finishes. vdev_inq_changed_fn() may get called after a LUN has been unregistered from the copy manager and before device deletion finishes. Reported-by: Gleb Chesnokov git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9341 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_copy_mgr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 68e081b8a..fd1f35e62 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2669,8 +2669,13 @@ void scst_cm_update_dev(struct scst_device *dev) spin_unlock_bh(&dev->dev_lock); lun = scst_cm_get_lun(dev); - if (WARN_ON_ONCE(lun == SCST_MAX_LUN)) + if (lun == SCST_MAX_LUN) { + /* + * Verify that scst_unregister_virtual_device() is in progress. + */ + WARN_ON_ONCE(!dev->remove_completion); goto out_unblock; + } rc = scst_cm_send_init_inquiry(dev, lun, NULL); if (rc != 0)