提交 28261402 编写于 作者: H Hannes Reinecke 提交者: Martin K. Petersen

revert commit a8e5a2d5 ("[SCSI] scsi_dh_alua: ALUA handler attach should...

revert commit a8e5a2d5 ("[SCSI] scsi_dh_alua: ALUA handler attach should succeed while TPG is transitioning")

This reverts commit a8e5a2d5

Obsoleted by the next patch.
Reviewed-by: NBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NEwan Milne <emilne@redhat.com>
Signed-off-by: NHannes Reinecke <hare@suse.de>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 a4253fde
...@@ -92,7 +92,7 @@ struct alua_dh_data { ...@@ -92,7 +92,7 @@ struct alua_dh_data {
#define ALUA_POLICY_SWITCH_CURRENT 0 #define ALUA_POLICY_SWITCH_CURRENT 0
#define ALUA_POLICY_SWITCH_ALL 1 #define ALUA_POLICY_SWITCH_ALL 1
static int alua_rtpg(struct scsi_device *, struct alua_port_group *, int); static int alua_rtpg(struct scsi_device *, struct alua_port_group *);
static char print_alua_state(int); static char print_alua_state(int);
static void release_port_group(struct kref *kref) static void release_port_group(struct kref *kref)
...@@ -326,7 +326,7 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h, ...@@ -326,7 +326,7 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h,
ALUA_DH_NAME, h->pg->device_id_str, ALUA_DH_NAME, h->pg->device_id_str,
h->group_id, h->rel_port); h->group_id, h->rel_port);
return alua_rtpg(sdev, h->pg, 0); return alua_rtpg(sdev, h->pg);
} }
static char print_alua_state(int state) static char print_alua_state(int state)
...@@ -409,13 +409,12 @@ static int alua_check_sense(struct scsi_device *sdev, ...@@ -409,13 +409,12 @@ static int alua_check_sense(struct scsi_device *sdev,
/* /*
* alua_rtpg - Evaluate REPORT TARGET GROUP STATES * alua_rtpg - Evaluate REPORT TARGET GROUP STATES
* @sdev: the device to be evaluated. * @sdev: the device to be evaluated.
* @wait_for_transition: if nonzero, wait ALUA_FAILOVER_TIMEOUT seconds for device to exit transitioning state
* *
* Evaluate the Target Port Group State. * Evaluate the Target Port Group State.
* Returns SCSI_DH_DEV_OFFLINED if the path is * Returns SCSI_DH_DEV_OFFLINED if the path is
* found to be unusable. * found to be unusable.
*/ */
static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg, int wait_for_transition) static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
{ {
struct scsi_sense_hdr sense_hdr; struct scsi_sense_hdr sense_hdr;
int len, k, off, valid_states = 0, bufflen = ALUA_RTPG_SIZE; int len, k, off, valid_states = 0, bufflen = ALUA_RTPG_SIZE;
...@@ -506,8 +505,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg, int w ...@@ -506,8 +505,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg, int w
else else
pg->transition_tmo = ALUA_FAILOVER_TIMEOUT; pg->transition_tmo = ALUA_FAILOVER_TIMEOUT;
if (wait_for_transition && if (orig_transition_tmo != pg->transition_tmo) {
(orig_transition_tmo != pg->transition_tmo)) {
sdev_printk(KERN_INFO, sdev, sdev_printk(KERN_INFO, sdev,
"%s: transition timeout set to %d seconds\n", "%s: transition timeout set to %d seconds\n",
ALUA_DH_NAME, pg->transition_tmo); ALUA_DH_NAME, pg->transition_tmo);
...@@ -545,19 +543,14 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg, int w ...@@ -545,19 +543,14 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg, int w
switch (pg->state) { switch (pg->state) {
case TPGS_STATE_TRANSITIONING: case TPGS_STATE_TRANSITIONING:
if (wait_for_transition) { if (time_before(jiffies, expiry)) {
if (time_before(jiffies, expiry)) { /* State transition, retry */
/* State transition, retry */ interval += 2000;
interval += 2000; msleep(interval);
msleep(interval); goto retry;
goto retry;
}
err = SCSI_DH_RETRY;
} else {
err = SCSI_DH_OK;
} }
/* Transitioning time exceeded, set port to standby */ /* Transitioning time exceeded, set port to standby */
err = SCSI_DH_RETRY;
pg->state = TPGS_STATE_STANDBY; pg->state = TPGS_STATE_STANDBY;
break; break;
case TPGS_STATE_OFFLINE: case TPGS_STATE_OFFLINE:
...@@ -713,14 +706,14 @@ static int alua_activate(struct scsi_device *sdev, ...@@ -713,14 +706,14 @@ static int alua_activate(struct scsi_device *sdev,
if (optimize_stpg) if (optimize_stpg)
h->pg->flags |= ALUA_OPTIMIZE_STPG; h->pg->flags |= ALUA_OPTIMIZE_STPG;
err = alua_rtpg(sdev, h->pg, 1); err = alua_rtpg(sdev, h->pg);
if (err != SCSI_DH_OK) { if (err != SCSI_DH_OK) {
kref_put(&h->pg->kref, release_port_group); kref_put(&h->pg->kref, release_port_group);
goto out; goto out;
} }
err = alua_stpg(sdev, h->pg); err = alua_stpg(sdev, h->pg);
if (err == SCSI_DH_RETRY) if (err == SCSI_DH_RETRY)
err = alua_rtpg(sdev, h->pg, 1); err = alua_rtpg(sdev, h->pg);
kref_put(&h->pg->kref, release_port_group); kref_put(&h->pg->kref, release_port_group);
out: out:
if (fn) if (fn)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册