stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Maurizio Lombardi <mlombard@redhat.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Sasha Levin <sashal@kernel.org>,
	open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 17/37] scsi: iscsi: flush running unbind operations when removing a session
Date: Fri, 29 Mar 2019 20:54:18 -0400	[thread overview]
Message-ID: <20190330005441.27540-17-sashal@kernel.org> (raw)
In-Reply-To: <20190330005441.27540-1-sashal@kernel.org>

From: Maurizio Lombardi <mlombard@redhat.com>

[ Upstream commit 165aa2bfb42904b1bec4bf2fa257c8c603c14a06 ]

In some cases, the iscsi_remove_session() function is called while an
unbind_work operation is still running.  This may cause a situation where
sysfs objects are removed in an incorrect order, triggering a kernel
warning.

[  605.249442] ------------[ cut here ]------------
[  605.259180] sysfs group 'power' not found for kobject 'target2:0:0'
[  605.321371] WARNING: CPU: 1 PID: 26794 at fs/sysfs/group.c:235 sysfs_remove_group+0x76/0x80
[  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
[  605.627479] CPU: 1 PID: 26794 Comm: kworker/u32:2 Not tainted 4.18.0-60.el8.x86_64 #1
[  605.721401] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20180724_192412-buildhw-07.phx2.fedoraproject.org-1.fc29 04/01/2014
[  605.823651] Workqueue: scsi_wq_2 __iscsi_unbind_session [scsi_transport_iscsi]
[  605.830940] RIP: 0010:sysfs_remove_group+0x76/0x80
[  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
[  606.122304] RSP: 0018:ffffbadcc8d1bda8 EFLAGS: 00010286
[  606.218492] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[  606.326381] RDX: ffff98bdfe85eb40 RSI: ffff98bdfe856818 RDI: ffff98bdfe856818
[  606.514498] RBP: ffffffffa7ab73e0 R08: 0000000000000268 R09: 0000000000000007
[  606.529469] R10: 0000000000000000 R11: ffffffffa860d9ad R12: ffff98bdf978e838
[  606.630535] R13: ffff98bdc2cd4010 R14: ffff98bdc2cd3ff0 R15: ffff98bdc2cd4000
[  606.824707] FS:  0000000000000000(0000) GS:ffff98bdfe840000(0000) knlGS:0000000000000000
[  607.018333] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  607.117844] CR2: 00007f84b78ac024 CR3: 000000002c00a003 CR4: 00000000003606e0
[  607.117844] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  607.420926] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  607.524236] Call Trace:
[  607.530591]  device_del+0x56/0x350
[  607.624393]  ? ata_tlink_match+0x30/0x30 [libata]
[  607.727805]  ? attribute_container_device_trigger+0xb4/0xf0
[  607.829911]  scsi_target_reap_ref_release+0x39/0x50
[  607.928572]  scsi_remove_target+0x1a2/0x1d0
[  608.017350]  __iscsi_unbind_session+0xb3/0x160 [scsi_transport_iscsi]
[  608.117435]  process_one_work+0x1a7/0x360
[  608.132917]  worker_thread+0x30/0x390
[  608.222900]  ? pwq_unbound_release_workfn+0xd0/0xd0
[  608.323989]  kthread+0x112/0x130
[  608.418318]  ? kthread_bind+0x30/0x30
[  608.513821]  ret_from_fork+0x35/0x40
[  608.613909] ---[ end trace 0b98c310c8a6138c ]---

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Acked-by: Chris Leech <cleech@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/scsi/scsi_transport_iscsi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index f6542c159ed6..b4d06bd9ed51 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -2185,6 +2185,8 @@ void iscsi_remove_session(struct iscsi_cls_session *session)
 	scsi_target_unblock(&session->dev, SDEV_TRANSPORT_OFFLINE);
 	/* flush running scans then delete devices */
 	flush_work(&session->scan_work);
+	/* flush running unbind operations */
+	flush_work(&session->unbind_work);
 	__iscsi_unbind_session(&session->unbind_work);
 
 	/* hw iscsi may not have removed all connections from session */
-- 
2.19.1


  parent reply	other threads:[~2019-03-30  1:03 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-30  0:54 [PATCH AUTOSEL 4.14 01/37] ARC: u-boot args: check that magic number is correct Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 02/37] arc: hsdk_defconfig: Enable CONFIG_BLK_DEV_RAM Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 03/37] perf/core: Restore mmap record type correctly Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 04/37] ext4: add missing brelse() in add_new_gdb_meta_bg() Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 05/37] ext4: report real fs size after failed resize Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 06/37] ALSA: echoaudio: add a check for ioremap_nocache Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 07/37] ALSA: sb8: add a check for request_region Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 08/37] auxdisplay: hd44780: Fix memory leak on ->remove() Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 09/37] IB/mlx4: Fix race condition between catas error reset and aliasguid flows Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 10/37] mmc: davinci: remove extraneous __init annotation Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 11/37] ALSA: opl3: fix mismatch between snd_opl3_drum_switch definition and declaration Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 12/37] thermal/intel_powerclamp: fix __percpu declaration of worker_data Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 13/37] thermal: bcm2835: Fix crash in bcm2835_thermal_debugfs Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 14/37] thermal/int340x_thermal: Add additional UUIDs Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 15/37] thermal/int340x_thermal: fix mode setting Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 16/37] thermal/intel_powerclamp: fix truncated kthread name Sasha Levin
2019-03-30  0:54 ` Sasha Levin [this message]
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 18/37] x86/mm: Don't leak kernel addresses Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 19/37] tools/power turbostat: return the exit status of a command Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 20/37] perf list: Don't forget to drop the reference to the allocated thread_map Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 21/37] perf config: Fix an error in the config template documentation Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 22/37] perf config: Fix a memory leak in collect_config() Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 23/37] perf build-id: Fix memory leak in print_sdt_events() Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 24/37] perf top: Fix error handling in cmd_top() Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 25/37] perf hist: Add missing map__put() in error case Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 26/37] perf evsel: Free evsel->counts in perf_evsel__exit() Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 27/37] perf tests: Fix a memory leak of cpu_map object in the openat_syscall_event_on_all_cpus test Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 28/37] perf tests: Fix memory leak by expr__find_other() in test__expr() Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 29/37] perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test() Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 30/37] irqchip/mbigen: Don't clear eventid when freeing an MSI Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 31/37] x86/hpet: Prevent potential NULL pointer dereference Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 32/37] x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 33/37] drm/nouveau/debugfs: Fix check of pm_runtime_get_sync failure Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 34/37] iommu/vt-d: Check capability before disabling protected memory Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 35/37] x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 36/37] fix incorrect error code mapping for OBJECTID_NOT_FOUND Sasha Levin
2019-03-30  0:54 ` [PATCH AUTOSEL 4.14 37/37] ext4: prohibit fstrim in norecovery mode Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190330005441.27540-17-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mlombard@redhat.com \
    --cc=open-iscsi@googlegroups.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).