aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2011-07-25 15:31:34 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2011-10-10 17:15:24 -0400
commitcf350e1eed909c4af8bfe835b7f969cbd2e02ee3 (patch)
tree6efe6f3ba0d8e196e3d8f1327229013e547fe3e5 /litmus
parent88f2d7fbab4ceba14946cb86c018bc8a2025e876 (diff)
ftdev: don't hold lock while sleeping
Holding the lock prevents other tasks from opening the device.
Diffstat (limited to 'litmus')
-rw-r--r--litmus/ftdev.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/litmus/ftdev.c b/litmus/ftdev.c
index 216dc0b4cb94..e282f8a9c067 100644
--- a/litmus/ftdev.c
+++ b/litmus/ftdev.c
@@ -229,13 +229,20 @@ static ssize_t ftdev_read(struct file *filp,
229 * here with copied data because that data would get 229 * here with copied data because that data would get
230 * lost if the task is interrupted (e.g., killed). 230 * lost if the task is interrupted (e.g., killed).
231 */ 231 */
232 mutex_unlock(&ftdm->lock);
232 set_current_state(TASK_INTERRUPTIBLE); 233 set_current_state(TASK_INTERRUPTIBLE);
234
233 schedule_timeout(50); 235 schedule_timeout(50);
236
234 if (signal_pending(current)) { 237 if (signal_pending(current)) {
235 if (err == 0) 238 if (err == 0)
236 /* nothing read yet, signal problem */ 239 /* nothing read yet, signal problem */
237 err = -ERESTARTSYS; 240 err = -ERESTARTSYS;
238 break; 241 goto out;
242 }
243 if (mutex_lock_interruptible(&ftdm->lock)) {
244 err = -ERESTARTSYS;
245 goto out;
239 } 246 }
240 } else if (copied < 0) { 247 } else if (copied < 0) {
241 /* page fault */ 248 /* page fault */