Skip to content

Commit f449395

Browse files
NickJackolsonVasily Gorbik
authored andcommitted
s390/hypfs_diag: Diag204 busy loop
When diag204 busy-indiciation facility is installed and diag204 is returning busy, hypfs diag204 handler now does an interruptable busy wait until diag204 is no longer busy. If there is a signal pending, call would be restarted with -ERESTARTSYSCALL, except for fatal signals. Acked-by: Heiko Carstens <[email protected]> Reviewed-by: Tobias Huschle <[email protected]> Signed-off-by: Mete Durlu <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 97999f8 commit f449395

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

arch/s390/hypfs/hypfs_dbfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ static ssize_t dbfs_read(struct file *file, char __user *buf,
3939
return 0;
4040

4141
df = file_inode(file)->i_private;
42-
mutex_lock(&df->lock);
42+
if (mutex_lock_interruptible(&df->lock))
43+
return -ERESTARTSYS;
44+
4345
data = hypfs_dbfs_data_alloc(df);
4446
if (!data) {
4547
mutex_unlock(&df->lock);

arch/s390/hypfs/hypfs_diag.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,22 @@ static int diag204_probe(void)
140140

141141
int diag204_store(void *buf, int pages)
142142
{
143+
unsigned long subcode;
143144
int rc;
144145

145-
rc = diag204((unsigned long)diag204_store_sc |
146-
(unsigned long)diag204_get_info_type(), pages, buf);
147-
return rc < 0 ? -EOPNOTSUPP : 0;
146+
subcode = diag204_get_info_type();
147+
subcode |= diag204_store_sc;
148+
if (diag204_has_bif())
149+
subcode |= DIAG204_BIF_BIT;
150+
while (1) {
151+
rc = diag204(subcode, pages, buf);
152+
if (rc != -EBUSY)
153+
break;
154+
if (signal_pending(current))
155+
return -ERESTARTSYS;
156+
schedule_timeout_interruptible(DIAG204_BUSY_WAIT);
157+
}
158+
return rc < 0 ? rc : 0;
148159
}
149160

150161
struct dbfs_d204_hdr {

arch/s390/include/asm/diag.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ enum diag204_sc {
119119

120120
#define DIAG204_SUBCODE_MASK 0xffff
121121
#define DIAG204_BIF_BIT 0x80000000
122+
#define DIAG204_BUSY_WAIT (HZ / 10)
122123

123124
/* The two available diag 204 data formats */
124125
enum diag204_format {

0 commit comments

Comments
 (0)