cifs, freezer: add wait_event_freezekillable and have cifs use it (Closes: #488794)
svn path=/dists/trunk/linux-2.6/; revision=18244
This commit is contained in:
parent
609a1e3502
commit
40ebbb135b
|
@ -5,6 +5,8 @@ linux-2.6 (3.1.0-1~experimental.2) UNRELEASED; urgency=low
|
|||
* iwlagn: fix modinfo display for 135 ucode (Closes: #647958)
|
||||
* [powerpc] ptrace: Fix build with gcc 4.6
|
||||
* [arm] add io{read,write}{16,32}be functions (fixes FTBFS)
|
||||
* cifs, freezer: add wait_event_freezekillable and have cifs use it
|
||||
(Closes: #488794)
|
||||
|
||||
-- Ben Hutchings <ben@decadent.org.uk> Fri, 04 Nov 2011 15:05:47 +0000
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
From: Steve French <smfrench@gmail.com>
|
||||
Date: Wed, 19 Oct 2011 21:27:11 -0500
|
||||
Subject: [PATCH] [CIFS] Fixup trivial checkpatch warning
|
||||
|
||||
commit b957ae9c53d5715a07f8bac644d8ff0a407c7e07 upstream.
|
||||
|
||||
Signed-off-by: Steve French <smfrench@gmail.com>
|
||||
---
|
||||
include/linux/freezer.h | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
|
||||
index 3672f73..a155561 100644
|
||||
--- a/include/linux/freezer.h
|
||||
+++ b/include/linux/freezer.h
|
||||
@@ -143,7 +143,7 @@ static inline void set_freezable_with_signal(void)
|
||||
({ \
|
||||
int __retval; \
|
||||
do { \
|
||||
- __retval = wait_event_killable(wq, \
|
||||
+ __retval = wait_event_killable(wq, \
|
||||
(condition) || freezing(current)); \
|
||||
if (__retval && !freezing(current)) \
|
||||
break; \
|
||||
--
|
||||
1.7.7.2
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
From: Steve French <smfrench@gmail.com>
|
||||
Date: Tue, 25 Oct 2011 10:02:53 -0500
|
||||
Subject: [PATCH] Fix build break when freezer not configured
|
||||
|
||||
commit e0c8ea1a69410ef44043646938a6a4175f5307e4 upstream.
|
||||
|
||||
fs/cifs/transport.c: In function 'wait_for_response':
|
||||
fs/cifs/transport.c:328: error: implicit declaration of function 'wait_event_freezekillable'
|
||||
|
||||
Caused by commit f06ac72e9291 ("cifs, freezer: add
|
||||
wait_event_freezekillable and have cifs use it"). In this config,
|
||||
CONFIG_FREEZER is not set.
|
||||
|
||||
Reviewed-by: Shirish Pargaonkar <shirishp@us.ibm.com>
|
||||
CC: Jeff Layton <jlayton@redhat.com>
|
||||
Signed-off-by: Steve French <smfrench@gmail.com>
|
||||
---
|
||||
include/linux/freezer.h | 3 +++
|
||||
1 files changed, 3 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
|
||||
index a155561..5989883 100644
|
||||
--- a/include/linux/freezer.h
|
||||
+++ b/include/linux/freezer.h
|
||||
@@ -203,6 +203,9 @@ static inline void set_freezable_with_signal(void) {}
|
||||
#define wait_event_freezable_timeout(wq, condition, timeout) \
|
||||
wait_event_interruptible_timeout(wq, condition, timeout)
|
||||
|
||||
+#define wait_event_freezekillable(wq, condition) \
|
||||
+ wait_event_killable(wq, condition)
|
||||
+
|
||||
#endif /* !CONFIG_FREEZER */
|
||||
|
||||
#endif /* FREEZER_H_INCLUDED */
|
||||
--
|
||||
1.7.7.2
|
||||
|
64
debian/patches/bugfix/all/PM-Freezer-Reimplement-wait_event_freezekillable-usi.patch
vendored
Normal file
64
debian/patches/bugfix/all/PM-Freezer-Reimplement-wait_event_freezekillable-usi.patch
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
From: Oleg Nesterov <oleg@redhat.com>
|
||||
Date: Thu, 3 Nov 2011 16:07:49 -0700
|
||||
Subject: [PATCH] PM / Freezer: Reimplement wait_event_freezekillable using
|
||||
freezer_do_not_count/freezer_count
|
||||
|
||||
commit 6f35c4abd7f0294166a5e0ab0401fe7949b33034 upstream.
|
||||
|
||||
Commit 27920651fe "PM / Freezer: Make fake_signal_wake_up() wake
|
||||
TASK_KILLABLE tasks too" updated fake_signal_wake_up() used by freezer
|
||||
to wake up KILLABLE tasks. Sending unsolicited wakeups to tasks in
|
||||
killable sleep is dangerous as there are code paths which depend on
|
||||
tasks not waking up spuriously from KILLABLE sleep.
|
||||
|
||||
For example. sys_read() or page can sleep in TASK_KILLABLE assuming
|
||||
that wait/down/whatever _killable can only fail if we can not return
|
||||
to the usermode. TASK_TRACED is another obvious example.
|
||||
|
||||
The offending commit was to resolve freezer hang during system PM
|
||||
operations caused by KILLABLE sleeps in network filesystems.
|
||||
wait_event_freezekillable(), which depends on the spurious KILLABLE
|
||||
wakeup, was added by f06ac72e92 "cifs, freezer: add
|
||||
wait_event_freezekillable and have cifs use it" to be used to
|
||||
implement killable & freezable sleeps in network filesystems.
|
||||
|
||||
To prepare for reverting of 27920651fe, this patch reimplements
|
||||
wait_event_freezekillable() using freezer_do_not_count/freezer_count()
|
||||
so that it doesn't depend on the spurious KILLABLE wakeup. This isn't
|
||||
very nice but should do for now.
|
||||
|
||||
[tj: Refreshed patch to apply to linus/master and updated commit
|
||||
description on Rafael's request.]
|
||||
|
||||
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
|
||||
Signed-off-by: Tejun Heo <tj@kernel.org>
|
||||
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
|
||||
---
|
||||
include/linux/freezer.h | 11 +++--------
|
||||
1 files changed, 3 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
|
||||
index a49b529..a5386e3 100644
|
||||
--- a/include/linux/freezer.h
|
||||
+++ b/include/linux/freezer.h
|
||||
@@ -143,14 +143,9 @@ static inline void set_freezable_with_signal(void)
|
||||
#define wait_event_freezekillable(wq, condition) \
|
||||
({ \
|
||||
int __retval; \
|
||||
- do { \
|
||||
- __retval = wait_event_killable(wq, \
|
||||
- (condition) || freezing(current)); \
|
||||
- if (__retval && !freezing(current)) \
|
||||
- break; \
|
||||
- else if (!(condition)) \
|
||||
- __retval = -ERESTARTSYS; \
|
||||
- } while (try_to_freeze()); \
|
||||
+ freezer_do_not_count(); \
|
||||
+ __retval = wait_event_killable(wq, (condition)); \
|
||||
+ freezer_count(); \
|
||||
__retval; \
|
||||
})
|
||||
|
||||
--
|
||||
1.7.7.2
|
||||
|
81
debian/patches/bugfix/all/cifs-freezer-add-wait_event_freezekillable-and-have-.patch
vendored
Normal file
81
debian/patches/bugfix/all/cifs-freezer-add-wait_event_freezekillable-and-have-.patch
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
From: Jeff Layton <jlayton@redhat.com>
|
||||
Date: Wed, 19 Oct 2011 15:30:40 -0400
|
||||
Subject: [PATCH] cifs, freezer: add wait_event_freezekillable and have cifs
|
||||
use it
|
||||
|
||||
commit f06ac72e929115f2772c29727152ba0832d641e4 upstream.
|
||||
|
||||
CIFS currently uses wait_event_killable to put tasks to sleep while
|
||||
they await replies from the server. That function though does not
|
||||
allow the freezer to run. In many cases, the network interface may
|
||||
be going down anyway, in which case the reply will never come. The
|
||||
client then ends up blocking the computer from suspending.
|
||||
|
||||
Fix this by adding a new wait_event_freezable variant --
|
||||
wait_event_freezekillable. The idea is to combine the behavior of
|
||||
wait_event_killable and wait_event_freezable -- put the task to
|
||||
sleep and only allow it to be awoken by fatal signals, but also
|
||||
allow the freezer to do its job.
|
||||
|
||||
Signed-off-by: Jeff Layton <jlayton@redhat.com>
|
||||
---
|
||||
fs/cifs/transport.c | 3 ++-
|
||||
include/linux/freezer.h | 19 +++++++++++++++++--
|
||||
2 files changed, 19 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
|
||||
index e7398d0..0cc9584 100644
|
||||
--- a/fs/cifs/transport.c
|
||||
+++ b/fs/cifs/transport.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <linux/wait.h>
|
||||
#include <linux/net.h>
|
||||
#include <linux/delay.h>
|
||||
+#include <linux/freezer.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/processor.h>
|
||||
#include <linux/mempool.h>
|
||||
@@ -324,7 +325,7 @@ wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ)
|
||||
{
|
||||
int error;
|
||||
|
||||
- error = wait_event_killable(server->response_q,
|
||||
+ error = wait_event_freezekillable(server->response_q,
|
||||
midQ->midState != MID_REQUEST_SUBMITTED);
|
||||
if (error < 0)
|
||||
return -ERESTARTSYS;
|
||||
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
|
||||
index 1effc8b..3672f73 100644
|
||||
--- a/include/linux/freezer.h
|
||||
+++ b/include/linux/freezer.h
|
||||
@@ -134,10 +134,25 @@ static inline void set_freezable_with_signal(void)
|
||||
}
|
||||
|
||||
/*
|
||||
- * Freezer-friendly wrappers around wait_event_interruptible() and
|
||||
- * wait_event_interruptible_timeout(), originally defined in <linux/wait.h>
|
||||
+ * Freezer-friendly wrappers around wait_event_interruptible(),
|
||||
+ * wait_event_killable() and wait_event_interruptible_timeout(), originally
|
||||
+ * defined in <linux/wait.h>
|
||||
*/
|
||||
|
||||
+#define wait_event_freezekillable(wq, condition) \
|
||||
+({ \
|
||||
+ int __retval; \
|
||||
+ do { \
|
||||
+ __retval = wait_event_killable(wq, \
|
||||
+ (condition) || freezing(current)); \
|
||||
+ if (__retval && !freezing(current)) \
|
||||
+ break; \
|
||||
+ else if (!(condition)) \
|
||||
+ __retval = -ERESTARTSYS; \
|
||||
+ } while (try_to_freeze()); \
|
||||
+ __retval; \
|
||||
+})
|
||||
+
|
||||
#define wait_event_freezable(wq, condition) \
|
||||
({ \
|
||||
int __retval; \
|
||||
--
|
||||
1.7.7.2
|
||||
|
|
@ -2,3 +2,7 @@
|
|||
+ bugfix/all/iwlagn-fix-modinfo-display-for-135-ucode.patch
|
||||
+ bugfix/powerpc/powerpc-ptrace-Fix-build-with-gcc-4.6.patch
|
||||
+ bugfix/arm/ARM-add-io-read-write-16-32-be-functions.patch
|
||||
+ bugfix/all/cifs-freezer-add-wait_event_freezekillable-and-have-.patch
|
||||
+ bugfix/all/CIFS-Fixup-trivial-checkpatch-warning.patch
|
||||
+ bugfix/all/Fix-build-break-when-freezer-not-configured.patch
|
||||
+ bugfix/all/PM-Freezer-Reimplement-wait_event_freezekillable-usi.patch
|
||||
|
|
Loading…
Reference in New Issue