]> Pileus Git - ~andy/linux/commit
[SCSI] qla2xxx: Correct race in loop_state assignment during reset handling.
authorAndrew Vasquez <andrew.vasquez@qlogic.com>
Fri, 8 Feb 2013 06:57:42 +0000 (01:57 -0500)
committerJames Bottomley <JBottomley@Parallels.com>
Fri, 22 Feb 2013 12:16:45 +0000 (12:16 +0000)
commit0b7e7c53307de217cfc7eeb036c9b8b013d67fcc
tree44e478f82dbcb9efc4fe272e3901f82644bbabca
parent78d56df6174f6858f79620e0e06ece326a744353
[SCSI] qla2xxx: Correct race in loop_state assignment during reset handling.

There's a subtle race in the loop/bus-reset handling whereby a
VHA's loop-state can get incorrectly set to 'down' after the
loop-reset and firmware's completion of link re-negotiation.  The
original code incorrectly assumes that firmware AENs would arrive
only after mailbox-command execution to initiate the link-flap.

Here's a good case with the old code (AENs arrive after
mailbox-command completion):

qla2xxx [0000:03:00.1]-8012:91: BUS RESET ISSUED nexus=91:0:4.
qla2xxx [0000:03:00.1]-287d:91: FCPort state transitioned from ONLINE to LOST - portid=010100.
qla2xxx [0000:03:00.1]-580e:91: Asynchronous P2P MODE received.
qla2xxx [0000:03:00.1]-287d:91: FCPort state transitioned from ONLINE to LOST - portid=010400.
qla2xxx [0000:03:00.1]-802b:91: BUS RESET SUCCEEDED nexus=91:0:4.
qla2xxx [0000:03:00.1]-480b:91: Reset marker scheduled.
qla2xxx [0000:03:00.1]-5812:91: Port database changed ffff 0006 0000.
qla2xxx [0000:03:00.1]-505f:91: Link is operational (4 Gbps).
qla2xxx [0000:03:00.1]-480c:91: Reset marker end.
qla2xxx [0000:03:00.1]-480f:91: Loop resync scheduled.
qla2xxx [0000:03:00.1]-8837:91: F/W Ready - OK.
qla2xxx [0000:03:00.1]-883a:91: fw_state=3 (7, 0, 0, 0) curr time=170b8f315.
qla2xxx [0000:03:00.1]-280e:91: HBA in F P2P topology.
qla2xxx [0000:03:00.1]-2812:91: qla2x00_configure_hba success
qla2xxx [0000:03:00.1]-2814:91: Configure loop -- dpc flags = 0x5260.

notice how the 'Port database changed' (8014) arrived after the
bus-reset handler completed 'BUS RESET SUCCEEDED'.

Now, here's a failing case with the old code (AENs arrive before
mailbox-command completion):

qla2xxx [0000:03:00.1]-8012:91: BUS RESET ISSUED nexus=91:0:0.
qla2xxx [0000:03:00.1]-580e:91: Asynchronous P2P MODE received.
qla2xxx [0000:03:00.1]-287d:91: FCPort state transitioned from ONLINE to LOST - portid=010100.
qla2xxx [0000:03:00.1]-287d:91: FCPort state transitioned from ONLINE to LOST - portid=010400.
qla2xxx [0000:03:00.1]-4800:91: DPC handler sleeping.
qla2xxx [0000:03:00.1]-5812:91: Port database changed ffff 0006 0000.
qla2xxx [0000:03:00.1]-505f:91: Link is operational (4 Gbps).
qla2xxx [0000:03:00.1]-802b:91: BUS RESET SUCCEEDED nexus=91:0:0.
qla2xxx [0000:03:00.1]-480b:91: Reset marker scheduled.
qla2xxx [0000:03:00.1]-480c:91: Reset marker end.
qla2xxx [0000:03:00.1]-480f:91: Loop resync scheduled.
qla2xxx [0000:03:00.1]-8837:91: F/W Ready - OK.
qla2xxx [0000:03:00.1]-883a:91: fw_state=3 (7, 0, 0, 0) curr time=170be9eb2.
qla2xxx [0000:03:00.1]-280e:91: HBA in F P2P topology.
qla2xxx [0000:03:00.1]-2812:91: qla2x00_configure_hba success
qla2xxx [0000:03:00.1]-2814:91: Configure loop -- dpc flags = 0x5260.
qla2xxx [0000:03:00.1]-281e:91: Needs RSCN update and loop transition.
qla2xxx [0000:03:00.1]-286a:91: qla2x00_configure_loop *** FAILED ***.
qla2xxx [0000:03:00.1]-4810:91: Loop resync end.
qla2xxx [0000:03:00.1]-4800:91: DPC handler sleeping.

This race would ultimately lead to devices go unexpectedly
offline until another link-flap or chip-reset would cause driver
re-discovery to take place.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/qla2xxx/qla_os.c