All of lore.kernel.org
 help / color / mirror / Atom feed
From: Todd Poynor <toddpoynor@google.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: fuse-devel@lists.sourceforge.net,
	Linux PM mailing list <linux-pm@lists.linux-foundation.org>
Subject: [PATCH] fuse: Freeze client on suspend when request sent to userspace
Date: Wed, 24 Aug 2011 16:59:24 -0700	[thread overview]
Message-ID: <1314230364-776-1-git-send-email-toddpoynor@google.com> (raw)

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.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
---
Have seen reports in which repeated suspend attempts were aborted
due to a task waiting uninterruptibly in this function, but
have only reproduced this artificially, by causing the daemon to
sleep.  Only modified the normal request path, not request aborts
and such, under the assumption that these should be rare and
should make progress upon resume.  Certain apps that read or
write a lot of data on the filesystem may apparently run into
this case rather frequently.

 fs/fuse/dev.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 168a80f..bded2e5 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -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)
-- 
1.7.3.1

             reply	other threads:[~2011-08-24 23:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 23:59 Todd Poynor [this message]
2011-08-25 14:20 ` [PATCH] fuse: Freeze client on suspend when request sent to userspace Miklos Szeredi
2011-08-25 14:20 ` Miklos Szeredi
2011-08-25 14:20   ` Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1314230364-776-1-git-send-email-toddpoynor@google.com \
    --to=toddpoynor@google.com \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.