aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/vmur.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-06-16 20:24:53 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-06-16 20:24:53 -0400
commit492b057c426e4aa747484958e18e9da29003985d (patch)
tree34e08c24618688d8bcc190523028b5f94cce0c0b /drivers/s390/char/vmur.c
parent313485175da221c388f6a8ecf4c30062ba9bea17 (diff)
parent300df7dc89cc276377fc020704e34875d5c473b6 (diff)
Merge commit 'origin/master' into next
Diffstat (limited to 'drivers/s390/char/vmur.c')
-rw-r--r--drivers/s390/char/vmur.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 5dcef81fc9d9..92458219a9e9 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -2,7 +2,7 @@
2 * Linux driver for System z and s390 unit record devices 2 * Linux driver for System z and s390 unit record devices
3 * (z/VM virtual punch, reader, printer) 3 * (z/VM virtual punch, reader, printer)
4 * 4 *
5 * Copyright IBM Corp. 2001, 2007 5 * Copyright IBM Corp. 2001, 2009
6 * Authors: Malcolm Beattie <beattiem@uk.ibm.com> 6 * Authors: Malcolm Beattie <beattiem@uk.ibm.com>
7 * Michael Holzheu <holzheu@de.ibm.com> 7 * Michael Holzheu <holzheu@de.ibm.com>
8 * Frank Munzert <munzert@de.ibm.com> 8 * Frank Munzert <munzert@de.ibm.com>
@@ -60,6 +60,7 @@ static int ur_probe(struct ccw_device *cdev);
60static void ur_remove(struct ccw_device *cdev); 60static void ur_remove(struct ccw_device *cdev);
61static int ur_set_online(struct ccw_device *cdev); 61static int ur_set_online(struct ccw_device *cdev);
62static int ur_set_offline(struct ccw_device *cdev); 62static int ur_set_offline(struct ccw_device *cdev);
63static int ur_pm_suspend(struct ccw_device *cdev);
63 64
64static struct ccw_driver ur_driver = { 65static struct ccw_driver ur_driver = {
65 .name = "vmur", 66 .name = "vmur",
@@ -69,6 +70,7 @@ static struct ccw_driver ur_driver = {
69 .remove = ur_remove, 70 .remove = ur_remove,
70 .set_online = ur_set_online, 71 .set_online = ur_set_online,
71 .set_offline = ur_set_offline, 72 .set_offline = ur_set_offline,
73 .freeze = ur_pm_suspend,
72}; 74};
73 75
74static DEFINE_MUTEX(vmur_mutex); 76static DEFINE_MUTEX(vmur_mutex);
@@ -158,6 +160,28 @@ static void urdev_put(struct urdev *urd)
158} 160}
159 161
160/* 162/*
163 * State and contents of ur devices can be changed by class D users issuing
164 * CP commands such as PURGE or TRANSFER, while the Linux guest is suspended.
165 * Also the Linux guest might be logged off, which causes all active spool
166 * files to be closed.
167 * So we cannot guarantee that spool files are still the same when the Linux
168 * guest is resumed. In order to avoid unpredictable results at resume time
169 * we simply refuse to suspend if a ur device node is open.
170 */
171static int ur_pm_suspend(struct ccw_device *cdev)
172{
173 struct urdev *urd = cdev->dev.driver_data;
174
175 TRACE("ur_pm_suspend: cdev=%p\n", cdev);
176 if (urd->open_flag) {
177 pr_err("Unit record device %s is busy, %s refusing to "
178 "suspend.\n", dev_name(&cdev->dev), ur_banner);
179 return -EBUSY;
180 }
181 return 0;
182}
183
184/*
161 * Low-level functions to do I/O to a ur device. 185 * Low-level functions to do I/O to a ur device.
162 * alloc_chan_prog 186 * alloc_chan_prog
163 * free_chan_prog 187 * free_chan_prog