Skip to content

Commit 26d766c

Browse files
author
Martin Schwidefsky
committed
s390/3215: fix hanging console issue
The ccw_device_start in raw3215_start_io can fail. raw3215_try_io does not check if the request could be started and removes any pending timer. This can leave the system in a hanging state. Check for pending request after raw3215_start_io and start a timer if necessary. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent e2213e0 commit 26d766c

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

‎drivers/s390/char/con3215.c‎

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -288,12 +288,16 @@ static void raw3215_timeout(unsigned long __data)
288288
unsigned long flags;
289289

290290
spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
291-
if (raw->flags & RAW3215_TIMER_RUNS) {
292-
del_timer(&raw->timer);
293-
raw->flags &= ~RAW3215_TIMER_RUNS;
294-
if (!(raw->port.flags & ASYNC_SUSPENDED)) {
295-
raw3215_mk_write_req(raw);
296-
raw3215_start_io(raw);
291+
raw->flags &= ~RAW3215_TIMER_RUNS;
292+
if (!(raw->port.flags & ASYNC_SUSPENDED)) {
293+
raw3215_mk_write_req(raw);
294+
raw3215_start_io(raw);
295+
if ((raw->queued_read || raw->queued_write) &&
296+
!(raw->flags & RAW3215_WORKING) &&
297+
!(raw->flags & RAW3215_TIMER_RUNS)) {
298+
raw->timer.expires = RAW3215_TIMEOUT + jiffies;
299+
add_timer(&raw->timer);
300+
raw->flags |= RAW3215_TIMER_RUNS;
297301
}
298302
}
299303
spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags);
@@ -317,17 +321,15 @@ static inline void raw3215_try_io(struct raw3215_info *raw)
317321
(raw->flags & RAW3215_FLUSHING)) {
318322
/* execute write requests bigger than minimum size */
319323
raw3215_start_io(raw);
320-
if (raw->flags & RAW3215_TIMER_RUNS) {
321-
del_timer(&raw->timer);
322-
raw->flags &= ~RAW3215_TIMER_RUNS;
323-
}
324-
} else if (!(raw->flags & RAW3215_TIMER_RUNS)) {
325-
/* delay small writes */
326-
raw->timer.expires = RAW3215_TIMEOUT + jiffies;
327-
add_timer(&raw->timer);
328-
raw->flags |= RAW3215_TIMER_RUNS;
329324
}
330325
}
326+
if ((raw->queued_read || raw->queued_write) &&
327+
!(raw->flags & RAW3215_WORKING) &&
328+
!(raw->flags & RAW3215_TIMER_RUNS)) {
329+
raw->timer.expires = RAW3215_TIMEOUT + jiffies;
330+
add_timer(&raw->timer);
331+
raw->flags |= RAW3215_TIMER_RUNS;
332+
}
331333
}
332334

333335
/*

0 commit comments

Comments
 (0)