diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-07-25 15:31:34 -0400 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2011-07-25 15:31:34 -0400 |
commit | ed883cf6c3990573f639cab888944322e7f319b9 (patch) | |
tree | ae56f282e9cfa5c141deb46d888df852dca9d0c7 | |
parent | 70a103e9dd0e160e97c7bf0dc55f94caa6ff5ffe (diff) |
ftdev: don't hold lock while sleeping
Holding the lock prevents other tasks from opening the device.
-rw-r--r-- | litmus/ftdev.c | 9 |
1 files changed, 8 insertions, 1 deletions
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, | |||
230 | * here with copied data because that data would get | 230 | * here with copied data because that data would get |
231 | * lost if the task is interrupted (e.g., killed). | 231 | * lost if the task is interrupted (e.g., killed). |
232 | */ | 232 | */ |
233 | mutex_unlock(&ftdm->lock); | ||
233 | set_current_state(TASK_INTERRUPTIBLE); | 234 | set_current_state(TASK_INTERRUPTIBLE); |
235 | |||
234 | schedule_timeout(50); | 236 | schedule_timeout(50); |
237 | |||
235 | if (signal_pending(current)) { | 238 | if (signal_pending(current)) { |
236 | if (err == 0) | 239 | if (err == 0) |
237 | /* nothing read yet, signal problem */ | 240 | /* nothing read yet, signal problem */ |
238 | err = -ERESTARTSYS; | 241 | err = -ERESTARTSYS; |
239 | break; | 242 | goto out; |
243 | } | ||
244 | if (mutex_lock_interruptible(&ftdm->lock)) { | ||
245 | err = -ERESTARTSYS; | ||
246 | goto out; | ||
240 | } | 247 | } |
241 | } else if (copied < 0) { | 248 | } else if (copied < 0) { |
242 | /* page fault */ | 249 | /* page fault */ |