mirror of
https://github.com/brain-hackers/linux-brain.git
synced 2024-06-09 15:26:21 +09:00
target: fix ALUA transition timeout handling
[ Upstream commit d7175373f2
]
The implicit transition time tells initiators the min time
to wait before timing out a transition. We currently schedule
the transition to occur in tg_pt_gp_implicit_trans_secs
seconds so there is no room for delays. If
core_alua_do_transition_tg_pt_work->core_alua_update_tpg_primary_metadata
needs to write out info to a remote file, then the initiator can
easily time out the operation.
Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
0d34f4770e
commit
892e4f9bc2
|
@ -1010,7 +1010,7 @@ static void core_alua_queue_state_change_ua(struct t10_alua_tg_pt_gp *tg_pt_gp)
|
|||
static void core_alua_do_transition_tg_pt_work(struct work_struct *work)
|
||||
{
|
||||
struct t10_alua_tg_pt_gp *tg_pt_gp = container_of(work,
|
||||
struct t10_alua_tg_pt_gp, tg_pt_gp_transition_work.work);
|
||||
struct t10_alua_tg_pt_gp, tg_pt_gp_transition_work);
|
||||
struct se_device *dev = tg_pt_gp->tg_pt_gp_dev;
|
||||
bool explicit = (tg_pt_gp->tg_pt_gp_alua_access_status ==
|
||||
ALUA_STATUS_ALTERED_BY_EXPLICIT_STPG);
|
||||
|
@ -1073,13 +1073,12 @@ static int core_alua_do_transition_tg_pt(
|
|||
/*
|
||||
* Flush any pending transitions
|
||||
*/
|
||||
if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs &&
|
||||
atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state) ==
|
||||
if (!explicit && atomic_read(&tg_pt_gp->tg_pt_gp_alua_access_state) ==
|
||||
ALUA_ACCESS_STATE_TRANSITION) {
|
||||
/* Just in case */
|
||||
tg_pt_gp->tg_pt_gp_alua_pending_state = new_state;
|
||||
tg_pt_gp->tg_pt_gp_transition_complete = &wait;
|
||||
flush_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work);
|
||||
flush_work(&tg_pt_gp->tg_pt_gp_transition_work);
|
||||
wait_for_completion(&wait);
|
||||
tg_pt_gp->tg_pt_gp_transition_complete = NULL;
|
||||
return 0;
|
||||
|
@ -1114,15 +1113,9 @@ static int core_alua_do_transition_tg_pt(
|
|||
atomic_inc(&tg_pt_gp->tg_pt_gp_ref_cnt);
|
||||
spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
|
||||
|
||||
if (!explicit && tg_pt_gp->tg_pt_gp_implicit_trans_secs) {
|
||||
unsigned long transition_tmo;
|
||||
|
||||
transition_tmo = tg_pt_gp->tg_pt_gp_implicit_trans_secs * HZ;
|
||||
schedule_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work,
|
||||
transition_tmo);
|
||||
} else {
|
||||
schedule_work(&tg_pt_gp->tg_pt_gp_transition_work);
|
||||
if (explicit) {
|
||||
tg_pt_gp->tg_pt_gp_transition_complete = &wait;
|
||||
schedule_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work, 0);
|
||||
wait_for_completion(&wait);
|
||||
tg_pt_gp->tg_pt_gp_transition_complete = NULL;
|
||||
}
|
||||
|
@ -1690,8 +1683,8 @@ struct t10_alua_tg_pt_gp *core_alua_allocate_tg_pt_gp(struct se_device *dev,
|
|||
mutex_init(&tg_pt_gp->tg_pt_gp_md_mutex);
|
||||
spin_lock_init(&tg_pt_gp->tg_pt_gp_lock);
|
||||
atomic_set(&tg_pt_gp->tg_pt_gp_ref_cnt, 0);
|
||||
INIT_DELAYED_WORK(&tg_pt_gp->tg_pt_gp_transition_work,
|
||||
core_alua_do_transition_tg_pt_work);
|
||||
INIT_WORK(&tg_pt_gp->tg_pt_gp_transition_work,
|
||||
core_alua_do_transition_tg_pt_work);
|
||||
tg_pt_gp->tg_pt_gp_dev = dev;
|
||||
atomic_set(&tg_pt_gp->tg_pt_gp_alua_access_state,
|
||||
ALUA_ACCESS_STATE_ACTIVE_OPTIMIZED);
|
||||
|
@ -1799,7 +1792,7 @@ void core_alua_free_tg_pt_gp(
|
|||
dev->t10_alua.alua_tg_pt_gps_counter--;
|
||||
spin_unlock(&dev->t10_alua.tg_pt_gps_lock);
|
||||
|
||||
flush_delayed_work(&tg_pt_gp->tg_pt_gp_transition_work);
|
||||
flush_work(&tg_pt_gp->tg_pt_gp_transition_work);
|
||||
|
||||
/*
|
||||
* Allow a struct t10_alua_tg_pt_gp_member * referenced by
|
||||
|
|
|
@ -297,7 +297,7 @@ struct t10_alua_tg_pt_gp {
|
|||
struct list_head tg_pt_gp_lun_list;
|
||||
struct se_lun *tg_pt_gp_alua_lun;
|
||||
struct se_node_acl *tg_pt_gp_alua_nacl;
|
||||
struct delayed_work tg_pt_gp_transition_work;
|
||||
struct work_struct tg_pt_gp_transition_work;
|
||||
struct completion *tg_pt_gp_transition_complete;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user