NAK After applying this patch, while IOs were running on physical drive, issued controller reset from management utility. Observed below call trace. It is from scsi_device_quiesce(). Nov 27 19:24:21 ubuntu kernel: [ 1330.799311] INFO: task arcconf:2386 blocked for more than 120 seconds. Nov 27 19:24:21 ubuntu kernel: [ 1330.799841] Not tainted 5.4.0-rc1+ #2 Nov 27 19:24:21 ubuntu kernel: [ 1330.800235] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. Nov 27 19:24:21 ubuntu kernel: [ 1330.800678] arcconf D 0 2386 2173 0x00004000 Nov 27 19:24:21 ubuntu kernel: [ 1330.800682] Call Trace: Nov 27 19:24:21 ubuntu kernel: [ 1330.800699] __schedule+0x291/0x6f0 Nov 27 19:24:21 ubuntu kernel: [ 1330.800703] schedule+0x33/0xa0 Nov 27 19:24:21 ubuntu kernel: [ 1330.800710] blk_mq_freeze_queue_wait+0x4b/0xb0 Nov 27 19:24:21 ubuntu kernel: [ 1330.800717] ? wait_woken+0x80/0x80 Nov 27 19:24:21 ubuntu kernel: [ 1330.800721] blk_mq_freeze_queue+0x1a/0x20 Nov 27 19:24:21 ubuntu kernel: [ 1330.800727] scsi_device_quiesce+0x5d/0xb0 Nov 27 19:24:21 ubuntu kernel: [ 1330.800730] scsi_host_quiesce+0x41/0x60 Nov 27 19:24:21 ubuntu kernel: [ 1330.800742] aac_send_shutdown+0x7c/0x180 [aacraid] Nov 27 19:24:21 ubuntu kernel: [ 1330.800749] aac_reset_adapter+0x29f/0x760 [aacraid] Nov 27 19:24:21 ubuntu kernel: [ 1330.800757] ? security_capable+0x3f/0x60 Nov 27 19:24:21 ubuntu kernel: [ 1330.800762] aac_store_reset_adapter+0x41/0x60 [aacraid] Nov 27 19:24:21 ubuntu kernel: [ 1330.800770] dev_attr_store+0x17/0x30 Nov 27 19:24:21 ubuntu kernel: [ 1330.800777] sysfs_kf_write+0x3c/0x50 Nov 27 19:24:21 ubuntu kernel: [ 1330.800779] kernfs_fop_write+0x125/0x1a0 Nov 27 19:24:21 ubuntu kernel: [ 1330.800785] __vfs_write+0x1b/0x40 Nov 27 19:24:21 ubuntu kernel: [ 1330.800789] vfs_write+0xb1/0x1a0 Nov 27 19:24:21 ubuntu kernel: [ 1330.800792] ksys_write+0xa7/0xe0 Nov 27 19:24:21 ubuntu kernel: [ 1330.800795] __x64_sys_write+0x1a/0x20 Nov 27 19:24:21 ubuntu kernel: [ 1330.800802] do_syscall_64+0x57/0x190 Nov 27 19:24:21 ubuntu kernel: [ 1330.800806] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Nov 27 19:24:21 ubuntu kernel: [ 1330.800810] RIP: 0033:0x7f67cfb7c2b7 Nov 27 19:24:21 ubuntu kernel: [ 1330.800819] Code: Bad RIP value. Nov 27 19:24:21 ubuntu kernel: [ 1330.800821] RSP: 002b:00007ffeb23ca8c0 EFLAGS: 00000293 ORIG_RAX: 0000000000000001 Nov 27 19:24:21 ubuntu kernel: [ 1330.800823] RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 00007f67cfb7c2b7 Nov 27 19:24:21 ubuntu kernel: [ 1330.800825] RDX: 0000000000000002 RSI: 00007ffeb23ca8f0 RDI: 0000000000000006 Nov 27 19:24:21 ubuntu kernel: [ 1330.800826] RBP: 00007ffeb23ca8f0 R08: 0000000000000000 R09: 0000000000000000 Nov 27 19:24:21 ubuntu kernel: [ 1330.800828] R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000002 Nov 27 19:24:21 ubuntu kernel: [ 1330.800829] R13: 00007ffeb23cad20 R14: 00007ffeb23cadf0 R15: 00007ffeb23cac60 -----Original Message----- From: Hannes Reinecke <hare@xxxxxxx> Sent: Wednesday, November 20, 2019 16:01 To: Martin K. Petersen <martin.petersen@xxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx>; James Bottomley <james.bottomley@xxxxxxxxxxxxxxxxxxxxx>; linux-scsi@xxxxxxxxxxxxxxx; Hannes Reinecke <hare@xxxxxxx>; Balsundar P <balsundar.p@xxxxxxxxxxxxx>; Adaptec OEM Raid Solutions <aacraid@xxxxxxxxxxxxx> Subject: [PATCH 08/11] aacraid: use scsi_host_quiesce() to wait for I/O to complete EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe Instead of waiting for all I/O to complete by monitoring the request tags we can as well call scsi_host_quiesce() and drop the hand-crafted helpers. Cc: Balsundar P <balsundar.p@xxxxxxxxxxxxx> Cc: Adaptec OEM Raid Solutions <aacraid@xxxxxxxxxxxxx> Signed-off-by: Hannes Reinecke <hare@xxxxxxx> --- drivers/scsi/aacraid/comminit.c | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index f75878d773cf..a01dca86eb37 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c @@ -272,38 +272,6 @@ static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 *mem, q->entries = qsize; } -static void aac_wait_for_io_completion(struct aac_dev *aac) -{ - unsigned long flagv = 0; - int i = 0; - - for (i = 60; i; --i) { - struct scsi_device *dev; - struct scsi_cmnd *command; - int active = 0; - - __shost_for_each_device(dev, aac->scsi_host_ptr) { - spin_lock_irqsave(&dev->list_lock, flagv); - list_for_each_entry(command, &dev->cmd_list, list) { - if (command->SCp.phase == AAC_OWNER_FIRMWARE) { - active++; - break; - } - } - spin_unlock_irqrestore(&dev->list_lock, flagv); - if (active) - break; - - } - /* - * We can exit If all the commands are complete - */ - if (active == 0) - break; - ssleep(1); - } -} - /** * aac_send_shutdown - shutdown an adapter * @dev: Adapter to shutdown @@ -326,7 +294,7 @@ int aac_send_shutdown(struct aac_dev * dev) mutex_unlock(&dev->ioctl_mutex); } - aac_wait_for_io_completion(dev); + scsi_host_quiesce(dev->scsi_host_ptr); fibctx = aac_fib_alloc(dev); if (!fibctx) @@ -352,6 +320,7 @@ int aac_send_shutdown(struct aac_dev * dev) if (aac_is_src(dev) && dev->msi_enabled) aac_set_intx_mode(dev); + scsi_host_resume(dev->scsi_host_ptr); return status; } -- 2.16.4