mirror of https://gitee.com/openkylin/linux.git
IB/srpt: Simplify srpt_close_session()
Move a mutex lock and unlock statement from srpt_close_session() into srpt_disconnect_ch_sync(). Since the previous patch removed the last user of the return value of that function, change the return value of srpt_disconnect_ch_sync() into void. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
parent
a11253142e
commit
940874f8be
|
@ -1868,22 +1868,16 @@ static bool srpt_ch_closed(struct srpt_port *sport, struct srpt_rdma_ch *ch)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Send DREQ and wait for DREP. */
|
||||||
* Send DREQ and wait for DREP. Return true if and only if this function
|
static void srpt_disconnect_ch_sync(struct srpt_rdma_ch *ch)
|
||||||
* changed the state of @ch.
|
|
||||||
*/
|
|
||||||
static bool srpt_disconnect_ch_sync(struct srpt_rdma_ch *ch)
|
|
||||||
__must_hold(&sdev->mutex)
|
|
||||||
{
|
{
|
||||||
struct srpt_port *sport = ch->sport;
|
struct srpt_port *sport = ch->sport;
|
||||||
int ret;
|
|
||||||
|
|
||||||
lockdep_assert_held(&sport->mutex);
|
|
||||||
|
|
||||||
pr_debug("ch %s-%d state %d\n", ch->sess_name, ch->qp->qp_num,
|
pr_debug("ch %s-%d state %d\n", ch->sess_name, ch->qp->qp_num,
|
||||||
ch->state);
|
ch->state);
|
||||||
|
|
||||||
ret = srpt_disconnect_ch(ch);
|
mutex_lock(&sport->mutex);
|
||||||
|
srpt_disconnect_ch(ch);
|
||||||
mutex_unlock(&sport->mutex);
|
mutex_unlock(&sport->mutex);
|
||||||
|
|
||||||
while (wait_event_timeout(sport->ch_releaseQ, srpt_ch_closed(sport, ch),
|
while (wait_event_timeout(sport->ch_releaseQ, srpt_ch_closed(sport, ch),
|
||||||
|
@ -1891,8 +1885,6 @@ static bool srpt_disconnect_ch_sync(struct srpt_rdma_ch *ch)
|
||||||
pr_info("%s(%s-%d state %d): still waiting ...\n", __func__,
|
pr_info("%s(%s-%d state %d): still waiting ...\n", __func__,
|
||||||
ch->sess_name, ch->qp->qp_num, ch->state);
|
ch->sess_name, ch->qp->qp_num, ch->state);
|
||||||
|
|
||||||
mutex_lock(&sport->mutex);
|
|
||||||
return ret == 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __srpt_close_all_ch(struct srpt_port *sport)
|
static void __srpt_close_all_ch(struct srpt_port *sport)
|
||||||
|
@ -2991,11 +2983,8 @@ static void srpt_release_cmd(struct se_cmd *se_cmd)
|
||||||
static void srpt_close_session(struct se_session *se_sess)
|
static void srpt_close_session(struct se_session *se_sess)
|
||||||
{
|
{
|
||||||
struct srpt_rdma_ch *ch = se_sess->fabric_sess_ptr;
|
struct srpt_rdma_ch *ch = se_sess->fabric_sess_ptr;
|
||||||
struct srpt_port *sport = ch->sport;
|
|
||||||
|
|
||||||
mutex_lock(&sport->mutex);
|
|
||||||
srpt_disconnect_ch_sync(ch);
|
srpt_disconnect_ch_sync(ch);
|
||||||
mutex_unlock(&sport->mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue