fuse: Freeze client on suspend when request sent to userspace
authorTodd Poynor <toddpoynor@google.com>
Wed, 24 Aug 2011 22:01:30 +0000 (15:01 -0700)
committerTodd Poynor <toddpoynor@google.com>
Thu, 25 Aug 2011 00:02:43 +0000 (17:02 -0700)
Suspend attempts can abort when the FUSE daemon is already frozen
and a client is waiting uninterruptibly for a response, causing
freezing of tasks to fail.

Use the freeze-friendly wait API, but disregard other signals.

Change-Id: Icefb7e4bbc718ccb76bf3c04daaa5eeea7e0e63c
Signed-off-by: Todd Poynor <toddpoynor@google.com>
fs/fuse/dev.c

index 640fc229df10323b6c9fc94b0bda452157bf1ef0..99e13346a7522f055860863c897980e930efa149 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/pipe_fs_i.h>
 #include <linux/swap.h>
 #include <linux/splice.h>
+#include <linux/freezer.h>
 
 MODULE_ALIAS_MISCDEV(FUSE_MINOR);
 MODULE_ALIAS("devname:fuse");
@@ -383,7 +384,10 @@ __acquires(fc->lock)
         * Wait it out.
         */
        spin_unlock(&fc->lock);
-       wait_event(req->waitq, req->state == FUSE_REQ_FINISHED);
+
+       while (req->state != FUSE_REQ_FINISHED)
+               wait_event_freezable(req->waitq,
+                                    req->state == FUSE_REQ_FINISHED);
        spin_lock(&fc->lock);
 
        if (!req->aborted)