summaryrefslogtreecommitdiff
blob: 4f2fde84c67bea57a625be1713254879bc990df8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# HG changeset 42+74 patch
# User kfraser@localhost.localdomain
# Date 1181573766 -3600
# Node ID c09686d2bbffa5ec2152f685df0eaa090ddddd83
# Parent  07a5f92187ac57ffbd107571b2019be2f53bda98
Subject: Kernel threads need to be aware of freeze request,
by checking in their main loop.

xenbus/xenwatch threads are special with PF_NOFREEZE, since we're sure
that they do nothing to block other native device drivers.

Signed-off-by Ke Yu <ke.yu@intel.com>
Signed-off-by Kevin Tian <kevin.tian@intel.com>

blktap: blktap kthread must respond to freeze requests.
Signed-off-by: Keir Fraser <keir@xensource.com>

Acked-by: jbeulich@novell.com

---
 drivers/xen/blkback/blkback.c  |    3 +++
 drivers/xen/blktap/blktap.c    |    3 +++
 drivers/xen/xenbus/xenbus_xs.c |    2 ++
 3 files changed, 8 insertions(+)

--- a/drivers/xen/blkback/blkback.c	2007-08-27 14:01:25.000000000 -0400
+++ b/drivers/xen/blkback/blkback.c	2007-08-27 14:02:03.000000000 -0400
@@ -208,6 +208,9 @@ int blkif_schedule(void *arg)
 		printk(KERN_DEBUG "%s: started\n", current->comm);
 
 	while (!kthread_should_stop()) {
+		if (try_to_freeze())
+			continue;
+
 		wait_event_interruptible(
 			blkif->wq,
 			blkif->waiting_reqs || kthread_should_stop());
--- a/drivers/xen/blktap/blktap.c	2007-08-27 14:01:25.000000000 -0400
+++ b/drivers/xen/blktap/blktap.c	2007-08-27 14:02:03.000000000 -0400
@@ -942,6 +942,9 @@ int tap_blkif_schedule(void *arg)
 		printk(KERN_DEBUG "%s: started\n", current->comm);
 
 	while (!kthread_should_stop()) {
+		if (try_to_freeze())
+			continue;
+
 		wait_event_interruptible(
 			blkif->wq,
 			blkif->waiting_reqs || kthread_should_stop());
--- a/drivers/xen/xenbus/xenbus_xs.c	2007-08-27 14:01:25.000000000 -0400
+++ b/drivers/xen/xenbus/xenbus_xs.c	2007-08-27 14:01:25.000000000 -0400
@@ -718,6 +718,7 @@ static int xenwatch_thread(void *unused)
 	struct list_head *ent;
 	struct xs_stored_msg *msg;
 
+	current->flags |= PF_NOFREEZE;
 	for (;;) {
 		wait_event_interruptible(watch_events_waitq,
 					 !list_empty(&watch_events));
@@ -836,6 +837,7 @@ static int xenbus_thread(void *unused)
 {
 	int err;
 
+	current->flags |= PF_NOFREEZE;
 	for (;;) {
 		err = process_msg();
 		if (err)