]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/scsi-iscsi-flush-running-unbind-operations-when-remo.patch
autosel patches for 4.14
[thirdparty/kernel/stable-queue.git] / queue-4.14 / scsi-iscsi-flush-running-unbind-operations-when-remo.patch
1 From e7ab83510d3d37eef65586a7eca54beae2b22788 Mon Sep 17 00:00:00 2001
2 From: Maurizio Lombardi <mlombard@redhat.com>
3 Date: Mon, 28 Jan 2019 15:24:42 +0100
4 Subject: scsi: iscsi: flush running unbind operations when removing a session
5
6 [ Upstream commit 165aa2bfb42904b1bec4bf2fa257c8c603c14a06 ]
7
8 In some cases, the iscsi_remove_session() function is called while an
9 unbind_work operation is still running. This may cause a situation where
10 sysfs objects are removed in an incorrect order, triggering a kernel
11 warning.
12
13 [ 605.249442] ------------[ cut here ]------------
14 [ 605.259180] sysfs group 'power' not found for kobject 'target2:0:0'
15 [ 605.321371] WARNING: CPU: 1 PID: 26794 at fs/sysfs/group.c:235 sysfs_remove_group+0x76/0x80
16 [ 605.341266] Modules linked in: dm_service_time target_core_user target_core_pscsi target_core_file target_core_iblock iscsi_target_mod target_core_mod nls_utf8 isofs ppdev bochs_drm nfit ttm libnvdimm drm_kms_helper syscopyarea sysfillrect sysimgblt joydev pcspkr fb_sys_fops drm i2c_piix4 sg parport_pc parport xfs libcrc32c dm_multipath sr_mod sd_mod cdrom ata_generic 8021q garp mrp ata_piix stp crct10dif_pclmul crc32_pclmul llc libata crc32c_intel virtio_net net_failover ghash_clmulni_intel serio_raw failover sunrpc dm_mirror dm_region_hash dm_log dm_mod be2iscsi bnx2i cnic uio cxgb4i cxgb4 libcxgbi libcxgb qla4xxx iscsi_boot_sysfs iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi
17 [ 605.627479] CPU: 1 PID: 26794 Comm: kworker/u32:2 Not tainted 4.18.0-60.el8.x86_64 #1
18 [ 605.721401] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20180724_192412-buildhw-07.phx2.fedoraproject.org-1.fc29 04/01/2014
19 [ 605.823651] Workqueue: scsi_wq_2 __iscsi_unbind_session [scsi_transport_iscsi]
20 [ 605.830940] RIP: 0010:sysfs_remove_group+0x76/0x80
21 [ 605.922907] Code: 48 89 df 5b 5d 41 5c e9 38 c4 ff ff 48 89 df e8 e0 bf ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 38 73 cb a7 e8 24 77 d7 ff <0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 41 56 41 55 41 54 55
22 [ 606.122304] RSP: 0018:ffffbadcc8d1bda8 EFLAGS: 00010286
23 [ 606.218492] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
24 [ 606.326381] RDX: ffff98bdfe85eb40 RSI: ffff98bdfe856818 RDI: ffff98bdfe856818
25 [ 606.514498] RBP: ffffffffa7ab73e0 R08: 0000000000000268 R09: 0000000000000007
26 [ 606.529469] R10: 0000000000000000 R11: ffffffffa860d9ad R12: ffff98bdf978e838
27 [ 606.630535] R13: ffff98bdc2cd4010 R14: ffff98bdc2cd3ff0 R15: ffff98bdc2cd4000
28 [ 606.824707] FS: 0000000000000000(0000) GS:ffff98bdfe840000(0000) knlGS:0000000000000000
29 [ 607.018333] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
30 [ 607.117844] CR2: 00007f84b78ac024 CR3: 000000002c00a003 CR4: 00000000003606e0
31 [ 607.117844] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
32 [ 607.420926] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
33 [ 607.524236] Call Trace:
34 [ 607.530591] device_del+0x56/0x350
35 [ 607.624393] ? ata_tlink_match+0x30/0x30 [libata]
36 [ 607.727805] ? attribute_container_device_trigger+0xb4/0xf0
37 [ 607.829911] scsi_target_reap_ref_release+0x39/0x50
38 [ 607.928572] scsi_remove_target+0x1a2/0x1d0
39 [ 608.017350] __iscsi_unbind_session+0xb3/0x160 [scsi_transport_iscsi]
40 [ 608.117435] process_one_work+0x1a7/0x360
41 [ 608.132917] worker_thread+0x30/0x390
42 [ 608.222900] ? pwq_unbound_release_workfn+0xd0/0xd0
43 [ 608.323989] kthread+0x112/0x130
44 [ 608.418318] ? kthread_bind+0x30/0x30
45 [ 608.513821] ret_from_fork+0x35/0x40
46 [ 608.613909] ---[ end trace 0b98c310c8a6138c ]---
47
48 Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
49 Acked-by: Chris Leech <cleech@redhat.com>
50 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
51 Signed-off-by: Sasha Levin <sashal@kernel.org>
52 ---
53 drivers/scsi/scsi_transport_iscsi.c | 2 ++
54 1 file changed, 2 insertions(+)
55
56 diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
57 index f6542c159ed6..b4d06bd9ed51 100644
58 --- a/drivers/scsi/scsi_transport_iscsi.c
59 +++ b/drivers/scsi/scsi_transport_iscsi.c
60 @@ -2185,6 +2185,8 @@ void iscsi_remove_session(struct iscsi_cls_session *session)
61 scsi_target_unblock(&session->dev, SDEV_TRANSPORT_OFFLINE);
62 /* flush running scans then delete devices */
63 flush_work(&session->scan_work);
64 + /* flush running unbind operations */
65 + flush_work(&session->unbind_work);
66 __iscsi_unbind_session(&session->unbind_work);
67
68 /* hw iscsi may not have removed all connections from session */
69 --
70 2.19.1
71