Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4eac34529bce2b4cca9be90a6903c965baa8193c
Commit:     4eac34529bce2b4cca9be90a6903c965baa8193c
Parent:     f2405598e0678e9c93dd780f2a12fc562ece3d13
Author:     Michael Holzheu <[EMAIL PROTECTED]>
AuthorDate: Fri Aug 10 14:32:33 2007 +0200
Committer:  Martin Schwidefsky <[EMAIL PROTECTED]>
CommitDate: Fri Aug 10 14:32:38 2007 +0200

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Martin Schwidefsky <[EMAIL PROTECTED]>
---
 drivers/s390/char/vmur.c |    7 ++++++-
 drivers/s390/char/vmur.h |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c
index 04395c0..a9d5862 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;
diff --git a/drivers/s390/char/vmur.h b/drivers/s390/char/vmur.h
index 522a9df..2b3c564 100644
--- a/drivers/s390/char/vmur.h
+++ b/drivers/s390/char/vmur.h
@@ -53,6 +53,7 @@ struct file_control_block {
 #define FLG_SYSTEM_HOLD        0x04
 #define FLG_CP_DUMP    0x10
 #define FLG_USER_HOLD  0x20
+#define FLG_IN_USE     0x80
 
 /*
  * A struct urdev is created for each ur device that is made available
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to