Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] libfc: Do not let disc work cancel itself

When number of NPIV ports created are greater than the xids
allocated per pool -- for eg., creating 255 NPIV ports on a
system with nr_cpu_ids of 32, with each pool containing 128
xids -- and then generating a link event - for eg.,
shutdown/no shutdown -- on the switch port causes the hang
with the following stack trace.

Call Trace:
schedule_timeout+0x19d/0x230
wait_for_common+0xc0/0x170
__cancel_work_timer+0xcf/0x1b0
fc_disc_stop+0x16/0x30 [libfc]
fc_lport_reset_locked+0x47/0x90 [libfc]
fc_lport_enter_reset+0x67/0xe0 [libfc]
fc_lport_disc_callback+0xbc/0xe0 [libfc]
fc_disc_done+0xa8/0xf0 [libfc]
fc_disc_timeout+0x29/0x40 [libfc]
run_workqueue+0xb8/0x140
worker_thread+0x96/0x110
kthread+0x96/0xa0
child_rip+0xa/0x20

Fix is to not cancel the disc_work if discovery is already
stopped, thus allowing lport state machine to restart and try
discovery again.

Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Acked-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>

authored by

Bhanu Prakash Gollapudi and committed by
James Bottomley
c531b9b4 8b7ac2bb

+3 -4
+2 -3
drivers/scsi/libfc/fc_disc.c
··· 684 684 { 685 685 struct fc_disc *disc = &lport->disc; 686 686 687 - if (disc) { 687 + if (disc->pending) 688 688 cancel_delayed_work_sync(&disc->disc_work); 689 - fc_disc_stop_rports(disc); 690 - } 689 + fc_disc_stop_rports(disc); 691 690 } 692 691 693 692 /**
+1 -1
include/scsi/libfc.h
··· 721 721 * struct fc_disc - Discovery context 722 722 * @retry_count: Number of retries 723 723 * @pending: 1 if discovery is pending, 0 if not 724 - * @requesting: 1 if discovery has been requested, 0 if not 724 + * @requested: 1 if discovery has been requested, 0 if not 725 725 * @seq_count: Number of sequences used for discovery 726 726 * @buf_len: Length of the discovery buffer 727 727 * @disc_id: Discovery ID