Make iSCSI frontend less chatty while waiting for tasks termination.

MFC after:	1 week
This commit is contained in:
mav 2014-11-22 04:40:24 +00:00
parent 2cb1b07d69
commit 5959c5a3e6

View File

@ -1058,7 +1058,7 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs)
{
struct cfiscsi_data_wait *cdw;
union ctl_io *io;
int error, last;
int error, last, wait;
if (cs->cs_target == NULL)
return; /* No target yet, so nothing to do. */
@ -1103,16 +1103,20 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs)
/*
* Wait for CTL to terminate all the tasks.
*/
wait = cs->cs_outstanding_ctl_pdus;
if (wait > 0)
CFISCSI_SESSION_WARN(cs,
"waiting for CTL to terminate %d tasks", wait);
for (;;) {
refcount_acquire(&cs->cs_outstanding_ctl_pdus);
last = refcount_release(&cs->cs_outstanding_ctl_pdus);
if (last != 0)
break;
CFISCSI_SESSION_WARN(cs, "waiting for CTL to terminate tasks, "
"%d remaining", cs->cs_outstanding_ctl_pdus);
tsleep(__DEVOLATILE(void *, &cs->cs_outstanding_ctl_pdus),
0, "cfiscsi_terminate", hz / 100);
}
if (wait > 0)
CFISCSI_SESSION_WARN(cs, "tasks terminated");
}
static void