Skip to content

Commit e09056b

Browse files
cleechJames Bottomley
authored andcommitted
[SCSI] fnic: BUG: sleeping function called from invalid context during probe
I hit this during driver probe with the latest fnic updates (this trace is from a backport into a distro kernel, but the issue is the same). > BUG: sleeping function called from invalid context at mm/slab.c:3113 > in_atomic(): 0, irqs_disabled(): 1, pid: 610, name: work_for_cpu > INFO: lockdep is turned off. > irq event stamp: 0 > hardirqs last enabled at (0): [<(null)>] (null) > hardirqs last disabled at (0): [<ffffffff81070aa5>] > copy_process+0x5e5/0x1670 > softirqs last enabled at (0): [<ffffffff81070aa5>] > copy_process+0x5e5/0x1670 > softirqs last disabled at (0): [<(null)>] (null) > Pid: 610, comm: work_for_cpu Not tainted > Call Trace: > [<ffffffff810b2d10>] ? print_irqtrace_events+0xd0/0xe0 > [<ffffffff8105c1a7>] ? __might_sleep+0xf7/0x130 > [<ffffffff81184efb>] ? kmem_cache_alloc_trace+0x20b/0x2d0 > [<ffffffff8109709e>] ? __create_workqueue_key+0x3e/0x1d0 > [<ffffffff8109709e>] ? __create_workqueue_key+0x3e/0x1d0 > [<ffffffffa00c101c>] ? fnic_probe+0x977/0x11aa [fnic] > [<ffffffffa00c1048>] ? fnic_probe+0x9a3/0x11aa [fnic] > [<ffffffff81096f00>] ? do_work_for_cpu+0x0/0x30 > [<ffffffff812c6da7>] ? local_pci_probe+0x17/0x20 > [<ffffffff81096f18>] ? do_work_for_cpu+0x18/0x30 > [<ffffffff8109cdc6>] ? kthread+0x96/0xa0 > [<ffffffff8100c1ca>] ? child_rip+0xa/0x20 > [<ffffffff81550f80>] ? _spin_unlock_irq+0x30/0x40 > [<ffffffff8100bb10>] ? restore_args+0x0/0x30 > [<ffffffff8109cd30>] ? kthread+0x0/0xa0 > [<ffffffff8100c1c0>] ? child_rip+0x0/0x20 The problem is in this hunk of "FIP VLAN Discovery Feature Support" (d3c995f) create_singlethreaded_workqueue cannot be called with irqs disabled @@ -620,7 +634,29 @@ static int __devinit fnic_probe(struct pci_dev *pdev, vnic_dev_packet_filter(fnic->vdev, 1, 1, 0, 0, 0); vnic_dev_add_addr(fnic->vdev, FIP_ALL_ENODE_MACS); vnic_dev_add_addr(fnic->vdev, fnic->ctlr.ctl_src_addr); + fnic->set_vlan = fnic_set_vlan; fcoe_ctlr_init(&fnic->ctlr, FIP_MODE_AUTO); + setup_timer(&fnic->fip_timer, fnic_fip_notify_timer, + (unsigned long)fnic); + spin_lock_init(&fnic->vlans_lock); + INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame); + INIT_WORK(&fnic->event_work, fnic_handle_event); + skb_queue_head_init(&fnic->fip_frame_queue); + spin_lock_irqsave(&fnic_list_lock, flags); + if (!fnic_fip_queue) { + fnic_fip_queue = + create_singlethread_workqueue("fnic_fip_q"); + if (!fnic_fip_queue) { + spin_unlock_irqrestore(&fnic_list_lock, flags); + printk(KERN_ERR PFX "fnic FIP work queue " + "create failed\n"); + err = -ENOMEM; + goto err_out_free_max_pool; + } + } + spin_unlock_irqrestore(&fnic_list_lock, flags); + INIT_LIST_HEAD(&fnic->evlist); + INIT_LIST_HEAD(&fnic->vlans); } else { shost_printk(KERN_INFO, fnic->lport->host, "firmware uses non-FIP mode\n"); The attempts to make fnic_fip_queue a single instance for the driver while it's being created in probe look awkward anyway, why is this not created in fnic_init_module like the event workqueue? Signed-off-by: Chris Leech <cleech@redhat.com> Tested-by: Anantha Tungarakodi <atungara@cisco.com> Acked-by: Hiral Patel <hiralpat@cisco.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent 6431f5d commit e09056b

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

‎drivers/scsi/fnic/fnic.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
#define DRV_NAME "fnic"
4040
#define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
41-
#define DRV_VERSION "1.5.0.22"
41+
#define DRV_VERSION "1.5.0.23"
4242
#define PFX DRV_NAME ": "
4343
#define DFX DRV_NAME "%d: "
4444

‎drivers/scsi/fnic/fnic_main.c‎

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -642,19 +642,6 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
642642
INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame);
643643
INIT_WORK(&fnic->event_work, fnic_handle_event);
644644
skb_queue_head_init(&fnic->fip_frame_queue);
645-
spin_lock_irqsave(&fnic_list_lock, flags);
646-
if (!fnic_fip_queue) {
647-
fnic_fip_queue =
648-
create_singlethread_workqueue("fnic_fip_q");
649-
if (!fnic_fip_queue) {
650-
spin_unlock_irqrestore(&fnic_list_lock, flags);
651-
printk(KERN_ERR PFX "fnic FIP work queue "
652-
"create failed\n");
653-
err = -ENOMEM;
654-
goto err_out_free_max_pool;
655-
}
656-
}
657-
spin_unlock_irqrestore(&fnic_list_lock, flags);
658645
INIT_LIST_HEAD(&fnic->evlist);
659646
INIT_LIST_HEAD(&fnic->vlans);
660647
} else {
@@ -960,6 +947,13 @@ static int __init fnic_init_module(void)
960947
spin_lock_init(&fnic_list_lock);
961948
INIT_LIST_HEAD(&fnic_list);
962949

950+
fnic_fip_queue = create_singlethread_workqueue("fnic_fip_q");
951+
if (!fnic_fip_queue) {
952+
printk(KERN_ERR PFX "fnic FIP work queue create failed\n");
953+
err = -ENOMEM;
954+
goto err_create_fip_workq;
955+
}
956+
963957
fnic_fc_transport = fc_attach_transport(&fnic_fc_functions);
964958
if (!fnic_fc_transport) {
965959
printk(KERN_ERR PFX "fc_attach_transport error\n");
@@ -978,6 +972,8 @@ static int __init fnic_init_module(void)
978972
err_pci_register:
979973
fc_release_transport(fnic_fc_transport);
980974
err_fc_transport:
975+
destroy_workqueue(fnic_fip_queue);
976+
err_create_fip_workq:
981977
destroy_workqueue(fnic_event_queue);
982978
err_create_fnic_workq:
983979
kmem_cache_destroy(fnic_io_req_cache);

0 commit comments

Comments
 (0)