Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ctcm: suspend has to wait for outstanding I/O

State transition to DEV_STATE_STOPPED indicates all outstanding I/O has
finished. Add wait queue to wait for this state.

Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Frank Blaschka and committed by
David S. Miller
1e1815be b7c2aecc

+8
+5
drivers/s390/net/ctcm_main.c
··· 1720 1720 return 0; 1721 1721 netif_device_detach(priv->channel[READ]->netdev); 1722 1722 ctcm_close(priv->channel[READ]->netdev); 1723 + if (!wait_event_timeout(priv->fsm->wait_q, 1724 + fsm_getstate(priv->fsm) == DEV_STATE_STOPPED, CTCM_TIME_5_SEC)) { 1725 + netif_device_attach(priv->channel[READ]->netdev); 1726 + return -EBUSY; 1727 + } 1723 1728 ccw_device_set_offline(gdev->cdev[1]); 1724 1729 ccw_device_set_offline(gdev->cdev[0]); 1725 1730 return 0;
+1
drivers/s390/net/fsm.c
··· 27 27 return NULL; 28 28 } 29 29 strlcpy(this->name, name, sizeof(this->name)); 30 + init_waitqueue_head(&this->wait_q); 30 31 31 32 f = kzalloc(sizeof(fsm), order); 32 33 if (f == NULL) {
+2
drivers/s390/net/fsm.h
··· 66 66 char name[16]; 67 67 void *userdata; 68 68 int userint; 69 + wait_queue_head_t wait_q; 69 70 #if FSM_DEBUG_HISTORY 70 71 int history_index; 71 72 int history_size; ··· 198 197 printk(KERN_DEBUG "fsm(%s): New state %s\n", fi->name, 199 198 fi->f->state_names[newstate]); 200 199 #endif 200 + wake_up(&fi->wait_q); 201 201 } 202 202 203 203 /**