summaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/vmur.c
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@de.ibm.com>2007-08-10 14:32:33 +0200
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2007-08-10 14:32:38 +0200
commit4eac34529bce2b4cca9be90a6903c965baa8193c (patch)
tree2a0d04aa4ed5b9c2d9a75158c6c0715456443e5f /drivers/s390/char/vmur.c
parentf2405598e0678e9c93dd780f2a12fc562ece3d13 (diff)
downloadlinux-stable-4eac34529bce2b4cca9be90a6903c965baa8193c.tar.gz
linux-stable-4eac34529bce2b4cca9be90a6903c965baa8193c.tar.bz2
linux-stable-4eac34529bce2b4cca9be90a6903c965baa8193c.zip
[S390] vmur: add "top of queue" sanity check for reader open
If the z/VM reader is already open, it can happen that after opening the Linux reader device, not the topmost file is processed. According the semantics of the Linux z/VM unit record device driver, always the topmost file has to be processed. With this fix an error is returned if that is not the case. Signed-off-by: Michael Holzheu <holzheu@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/char/vmur.c')
-rw-r--r--drivers/s390/char/vmur.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 04395c0f99d8..a9d58629e795 100644
--- a/drivers/s390/char/vmur.c
+++ b/drivers/s390/char/vmur.c
@@ -565,9 +565,14 @@ static int verify_device(struct urdev *urd)
return -ENOMEM;
rc = diag_read_file(urd->dev_id.devno, buf);
kfree(buf);
-
if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */
return rc;
+ /* check if the file on top of the queue is open now */
+ rc = diag_read_next_file_info(&fcb, 0);
+ if (rc)
+ return rc;
+ if (!(fcb.file_stat & FLG_IN_USE))
+ return -EMFILE;
return 0;
default:
return -ENOTSUPP;