From patchwork Wed Aug 24 23:59:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Poynor X-Patchwork-Id: 1094662 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7P0Dq0e018152 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Thu, 25 Aug 2011 00:14:13 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p7P0Bl8u020188; Wed, 24 Aug 2011 17:11:48 -0700 Received: from smtp-out.google.com (smtp-out.google.com [216.239.44.51]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p7P0Bhn9020175 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 24 Aug 2011 17:11:45 -0700 Received: from wpaz21.hot.corp.google.com (wpaz21.hot.corp.google.com [172.24.198.85]) by smtp-out.google.com with ESMTP id p7P0BhLj008350; Wed, 24 Aug 2011 17:11:43 -0700 Received: from conslugarocko.mtv.corp.google.com (conslugarocko.mtv.corp.google.com [172.18.102.26]) by wpaz21.hot.corp.google.com with ESMTP id p7P0BfuJ015703; Wed, 24 Aug 2011 17:11:41 -0700 Received: by conslugarocko.mtv.corp.google.com (Postfix, from userid 115684) id 44161234249; Wed, 24 Aug 2011 17:02:04 -0700 (PDT) From: Todd Poynor To: Miklos Szeredi Date: Wed, 24 Aug 2011 16:59:24 -0700 Message-Id: <1314230364-776-1-git-send-email-toddpoynor@google.com> X-Mailer: git-send-email 1.7.3.1 Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-103.468 required=5 tests=AWL, BAYES_00, FRT_TODAY2, OSDL_HEADER_SPF_PASS, OSDL_HEADER_SUBJECT_BRACKETED, PATCH_SUBJECT_OSDL, USER_IN_WHITELIST X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Cc: fuse-devel@lists.sourceforge.net, Linux PM mailing list Subject: [linux-pm] [PATCH] fuse: Freeze client on suspend when request sent to userspace X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 25 Aug 2011 00:14:13 +0000 (UTC) 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 --- 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 #include #include +#include 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)