Skip to content

Commit 379a58c

Browse files
gonzoleemanmartinkpetersen
authored andcommitted
scsi: fnic: Move fnic_fnic_flush_tx() to a work queue
Rather than call 'fnic_flush_tx()' from interrupt context we should be moving it onto a work queue to avoid any locking issues. Fixes: 1a19755 ("scsi: fcoe: Fix potential deadlock on &fip->ctlr_lock") Co-developed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Lee Duncan <lduncan@suse.com> Link: https://lore.kernel.org/r/ce5ffa5d0ff82c2b2e283b3b4bff23291d49b05c.1707500786.git.lduncan@suse.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 977fe77 commit 379a58c

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

drivers/scsi/fnic/fnic.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ struct fnic {
305305
unsigned int copy_wq_base;
306306
struct work_struct link_work;
307307
struct work_struct frame_work;
308+
struct work_struct flush_work;
308309
struct sk_buff_head frame_queue;
309310
struct sk_buff_head tx_queue;
310311

@@ -363,7 +364,7 @@ void fnic_handle_event(struct work_struct *work);
363364
int fnic_rq_cmpl_handler(struct fnic *fnic, int);
364365
int fnic_alloc_rq_frame(struct vnic_rq *rq);
365366
void fnic_free_rq_buf(struct vnic_rq *rq, struct vnic_rq_buf *buf);
366-
void fnic_flush_tx(struct fnic *);
367+
void fnic_flush_tx(struct work_struct *work);
367368
void fnic_eth_send(struct fcoe_ctlr *, struct sk_buff *skb);
368369
void fnic_set_port_id(struct fc_lport *, u32, struct fc_frame *);
369370
void fnic_update_mac(struct fc_lport *, u8 *new);

drivers/scsi/fnic/fnic_fcs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,16 +1182,17 @@ int fnic_send(struct fc_lport *lp, struct fc_frame *fp)
11821182

11831183
/**
11841184
* fnic_flush_tx() - send queued frames.
1185-
* @fnic: fnic device
1185+
* @work: pointer to work element
11861186
*
11871187
* Send frames that were waiting to go out in FC or Ethernet mode.
11881188
* Whenever changing modes we purge queued frames, so these frames should
11891189
* be queued for the stable mode that we're in, either FC or Ethernet.
11901190
*
11911191
* Called without fnic_lock held.
11921192
*/
1193-
void fnic_flush_tx(struct fnic *fnic)
1193+
void fnic_flush_tx(struct work_struct *work)
11941194
{
1195+
struct fnic *fnic = container_of(work, struct fnic, flush_work);
11951196
struct sk_buff *skb;
11961197
struct fc_frame *fp;
11971198

drivers/scsi/fnic/fnic_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
830830
spin_lock_init(&fnic->vlans_lock);
831831
INIT_WORK(&fnic->fip_frame_work, fnic_handle_fip_frame);
832832
INIT_WORK(&fnic->event_work, fnic_handle_event);
833+
INIT_WORK(&fnic->flush_work, fnic_flush_tx);
833834
skb_queue_head_init(&fnic->fip_frame_queue);
834835
INIT_LIST_HEAD(&fnic->evlist);
835836
INIT_LIST_HEAD(&fnic->vlans);

drivers/scsi/fnic/fnic_scsi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ static int fnic_fcpio_fw_reset_cmpl_handler(struct fnic *fnic,
680680

681681
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
682682

683-
fnic_flush_tx(fnic);
683+
queue_work(fnic_event_queue, &fnic->flush_work);
684684

685685
reset_cmpl_handler_end:
686686
fnic_clear_state_flags(fnic, FNIC_FLAGS_FWRESET);
@@ -736,7 +736,7 @@ static int fnic_fcpio_flogi_reg_cmpl_handler(struct fnic *fnic,
736736
}
737737
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
738738

739-
fnic_flush_tx(fnic);
739+
queue_work(fnic_event_queue, &fnic->flush_work);
740740
queue_work(fnic_event_queue, &fnic->frame_work);
741741
} else {
742742
spin_unlock_irqrestore(&fnic->fnic_lock, flags);

0 commit comments

Comments
 (0)