ANDROID: fs: 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)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 18 Dec 2017 15:41:22 +0000 (21:11 +0530)
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 13c65dd2d37d1ab1af358f82b42c43ba8c2cc2de..9b35551d9986254be207405388eda97282eb0dc8 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/swap.h>
 #include <linux/splice.h>
 #include <linux/sched.h>
+#include <linux/freezer.h>
 
 MODULE_ALIAS_MISCDEV(FUSE_MINOR);
 MODULE_ALIAS("devname:fuse");
@@ -454,7 +455,9 @@ static void request_wait_answer(struct fuse_conn *fc, struct fuse_req *req)
         * Either request is already in userspace, or it was forced.
         * Wait it out.
         */
-       wait_event(req->waitq, test_bit(FR_FINISHED, &req->flags));
+       while (!test_bit(FR_FINISHED, &req->flags))
+               wait_event_freezable(req->waitq,
+                               test_bit(FR_FINISHED, &req->flags));
 }
 
 static void __fuse_request_send(struct fuse_conn *fc, struct fuse_req *req)