[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>

authored by Michael Holzheu and committed by Martin Schwidefsky 4eac3452 f2405598

+7 -1
+6 -1
drivers/s390/char/vmur.c
··· 565 return -ENOMEM; 566 rc = diag_read_file(urd->dev_id.devno, buf); 567 kfree(buf); 568 - 569 if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */ 570 return rc; 571 return 0; 572 default: 573 return -ENOTSUPP;
··· 565 return -ENOMEM; 566 rc = diag_read_file(urd->dev_id.devno, buf); 567 kfree(buf); 568 if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */ 569 return rc; 570 + /* check if the file on top of the queue is open now */ 571 + rc = diag_read_next_file_info(&fcb, 0); 572 + if (rc) 573 + return rc; 574 + if (!(fcb.file_stat & FLG_IN_USE)) 575 + return -EMFILE; 576 return 0; 577 default: 578 return -ENOTSUPP;
+1
drivers/s390/char/vmur.h
··· 53 #define FLG_SYSTEM_HOLD 0x04 54 #define FLG_CP_DUMP 0x10 55 #define FLG_USER_HOLD 0x20 56 57 /* 58 * A struct urdev is created for each ur device that is made available
··· 53 #define FLG_SYSTEM_HOLD 0x04 54 #define FLG_CP_DUMP 0x10 55 #define FLG_USER_HOLD 0x20 56 + #define FLG_IN_USE 0x80 57 58 /* 59 * A struct urdev is created for each ur device that is made available