Commit f4493954 authored by Mete Durlu's avatar Mete Durlu Committed by Vasily Gorbik
Browse files

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: default avatarHeiko Carstens <hca@linux.ibm.com>
Reviewed-by: default avatarTobias Huschle <huschle@linux.ibm.com>
Signed-off-by: default avatarMete Durlu <meted@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 97999f8c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -39,7 +39,9 @@ static ssize_t dbfs_read(struct file *file, char __user *buf,
		return 0;

	df = file_inode(file)->i_private;
	mutex_lock(&df->lock);
	if (mutex_lock_interruptible(&df->lock))
		return -ERESTARTSYS;

	data = hypfs_dbfs_data_alloc(df);
	if (!data) {
		mutex_unlock(&df->lock);
+14 −3
Original line number Diff line number Diff line
@@ -140,11 +140,22 @@ static int diag204_probe(void)

int diag204_store(void *buf, int pages)
{
	unsigned long subcode;
	int rc;

	rc = diag204((unsigned long)diag204_store_sc |
		     (unsigned long)diag204_get_info_type(), pages, buf);
	return rc < 0 ? -EOPNOTSUPP : 0;
	subcode = diag204_get_info_type();
	subcode |= diag204_store_sc;
	if (diag204_has_bif())
		subcode |= DIAG204_BIF_BIT;
	while (1) {
		rc = diag204(subcode, pages, buf);
		if (rc != -EBUSY)
			break;
		if (signal_pending(current))
			return -ERESTARTSYS;
		schedule_timeout_interruptible(DIAG204_BUSY_WAIT);
	}
	return rc < 0 ? rc : 0;
}

struct dbfs_d204_hdr {
+1 −0
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ enum diag204_sc {

#define DIAG204_SUBCODE_MASK 0xffff
#define DIAG204_BIF_BIT 0x80000000
#define DIAG204_BUSY_WAIT (HZ / 10)

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