From 676bcd5d0245afba6b723e4d1bf4a65692fa986d Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Mon, 25 Jul 2011 15:31:34 -0400 Subject: ftdev: don't hold lock while sleeping Holding the lock prevents other tasks from opening the device. --- litmus/ftdev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/litmus/ftdev.c b/litmus/ftdev.c index 06fcf4cf77dc..99bc39ffbcef 100644 --- a/litmus/ftdev.c +++ b/litmus/ftdev.c @@ -230,13 +230,20 @@ static ssize_t ftdev_read(struct file *filp, * here with copied data because that data would get * lost if the task is interrupted (e.g., killed). */ + mutex_unlock(&ftdm->lock); set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(50); + if (signal_pending(current)) { if (err == 0) /* nothing read yet, signal problem */ err = -ERESTARTSYS; - break; + goto out; + } + if (mutex_lock_interruptible(&ftdm->lock)) { + err = -ERESTARTSYS; + goto out; } } else if (copied < 0) { /* page fault */ -- cgit v1.2.2