Skip to content

Commit

Permalink
[S390] vmur: add "top of queue" sanity check for reader open
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Holzheu authored and Martin Schwidefsky committed Aug 10, 2007
1 parent f240559 commit 4eac345
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/s390/char/vmur.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions drivers/s390/char/vmur.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4eac345

Please sign in to comment.