Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263805
b: refs/heads/master
c: 77a2b73
h: refs/heads/master
i:
  263803: 68f9975
v: v3
  • Loading branch information
Vasu Dev authored and James Bottomley committed Aug 29, 2011
1 parent 65a457b commit 9f22bfe
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 848e7d5b46b9b0ee613a106bc460acf6a09a8546
refs/heads/master: 77a2b73a7805a3c6a473b6741aa514ef40295d26
51 changes: 35 additions & 16 deletions trunk/drivers/scsi/libfc/fc_exch.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,9 @@ static int fc_seq_send(struct fc_lport *lport, struct fc_seq *sp,
*/
error = lport->tt.frame_send(lport, fp);

if (fh->fh_type == FC_TYPE_BLS)
return error;

/*
* Update the exchange and sequence flags,
* assuming all frames for the sequence have been sent.
Expand Down Expand Up @@ -575,42 +578,35 @@ static void fc_seq_set_resp(struct fc_seq *sp,
}

/**
* fc_seq_exch_abort() - Abort an exchange and sequence
* @req_sp: The sequence to be aborted
* fc_exch_abort_locked() - Abort an exchange
* @ep: The exchange to be aborted
* @timer_msec: The period of time to wait before aborting
*
* Generally called because of a timeout or an abort from the upper layer.
* Locking notes: Called with exch lock held
*
* Return value: 0 on success else error code
*/
static int fc_seq_exch_abort(const struct fc_seq *req_sp,
unsigned int timer_msec)
static int fc_exch_abort_locked(struct fc_exch *ep,
unsigned int timer_msec)
{
struct fc_seq *sp;
struct fc_exch *ep;
struct fc_frame *fp;
int error;

ep = fc_seq_exch(req_sp);

spin_lock_bh(&ep->ex_lock);
if (ep->esb_stat & (ESB_ST_COMPLETE | ESB_ST_ABNORMAL) ||
ep->state & (FC_EX_DONE | FC_EX_RST_CLEANUP)) {
spin_unlock_bh(&ep->ex_lock);
ep->state & (FC_EX_DONE | FC_EX_RST_CLEANUP))
return -ENXIO;
}

/*
* Send the abort on a new sequence if possible.
*/
sp = fc_seq_start_next_locked(&ep->seq);
if (!sp) {
spin_unlock_bh(&ep->ex_lock);
if (!sp)
return -ENOMEM;
}

ep->esb_stat |= ESB_ST_SEQ_INIT | ESB_ST_ABNORMAL;
if (timer_msec)
fc_exch_timer_set_locked(ep, timer_msec);
spin_unlock_bh(&ep->ex_lock);

/*
* If not logged into the fabric, don't send ABTS but leave
Expand All @@ -632,6 +628,28 @@ static int fc_seq_exch_abort(const struct fc_seq *req_sp,
return error;
}

/**
* fc_seq_exch_abort() - Abort an exchange and sequence
* @req_sp: The sequence to be aborted
* @timer_msec: The period of time to wait before aborting
*
* Generally called because of a timeout or an abort from the upper layer.
*
* Return value: 0 on success else error code
*/
static int fc_seq_exch_abort(const struct fc_seq *req_sp,
unsigned int timer_msec)
{
struct fc_exch *ep;
int error;

ep = fc_seq_exch(req_sp);
spin_lock_bh(&ep->ex_lock);
error = fc_exch_abort_locked(ep, timer_msec);
spin_unlock_bh(&ep->ex_lock);
return error;
}

/**
* fc_exch_timeout() - Handle exchange timer expiration
* @work: The work_struct identifying the exchange that timed out
Expand Down Expand Up @@ -1715,6 +1733,7 @@ static void fc_exch_reset(struct fc_exch *ep)
int rc = 1;

spin_lock_bh(&ep->ex_lock);
fc_exch_abort_locked(ep, 0);
ep->state |= FC_EX_RST_CLEANUP;
if (cancel_delayed_work(&ep->timeout_work))
atomic_dec(&ep->ex_refcnt); /* drop hold for timer */
Expand Down
11 changes: 10 additions & 1 deletion trunk/drivers/scsi/libfc/fc_lport.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
*/

#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <asm/unaligned.h>

Expand Down Expand Up @@ -1029,8 +1030,16 @@ static void fc_lport_enter_reset(struct fc_lport *lport)
FCH_EVT_LIPRESET, 0);
fc_vports_linkchange(lport);
fc_lport_reset_locked(lport);
if (lport->link_up)
if (lport->link_up) {
/*
* Wait upto resource allocation time out before
* doing re-login since incomplete FIP exchanged
* from last session may collide with exchanges
* in new session.
*/
msleep(lport->r_a_tov);
fc_lport_enter_flogi(lport);
}
}

/**
Expand Down

0 comments on commit 9f22bfe

Please sign in to comment.