Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH 5/5] s390:block:fix up ENOIOCTLCMD error handling
       [not found] <1346052196-32682-1-git-send-email-gaowanlong@cn.fujitsu.com>
@ 2012-08-27  7:23 ` Wanlong Gao
  2012-08-27  9:03   ` Heiko Carstens
  0 siblings, 1 reply; 3+ messages in thread
From: Wanlong Gao @ 2012-08-27  7:23 UTC (permalink / raw)
  To: linux-kernel
  Cc: Wanlong Gao, Martin Schwidefsky, Heiko Carstens, linux390,
	open list:S390

At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.

Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org (open list:S390)
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
---
 drivers/s390/block/dasd_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index cceae70..809a89b 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -501,7 +501,7 @@ int dasd_ioctl(struct block_device *bdev, fmode_t mode,
 		if (base->discipline->ioctl) {
 			rc = base->discipline->ioctl(block, cmd, argp);
 			if (rc == -ENOIOCTLCMD)
-				rc = -EINVAL;
+				rc = -ENOTTY;
 		} else
 			rc = -EINVAL;
 	}
-- 
1.7.12

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 5/5] s390:block:fix up ENOIOCTLCMD error handling
  2012-08-27  7:23 ` [PATCH 5/5] s390:block:fix up ENOIOCTLCMD error handling Wanlong Gao
@ 2012-08-27  9:03   ` Heiko Carstens
  2012-08-27 10:25     ` Stefan Weinhuber
  0 siblings, 1 reply; 3+ messages in thread
From: Heiko Carstens @ 2012-08-27  9:03 UTC (permalink / raw)
  To: Wanlong Gao, Stefan Weinhuber
  Cc: linux-kernel, Martin Schwidefsky, linux390, open list:S390

On Mon, Aug 27, 2012 at 03:23:16PM +0800, Wanlong Gao wrote:
> At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
> translated as ENOTTY to user mode.
> 
[...]

> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
>  drivers/s390/block/dasd_ioctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
> index cceae70..809a89b 100644
> --- a/drivers/s390/block/dasd_ioctl.c
> +++ b/drivers/s390/block/dasd_ioctl.c
> @@ -501,7 +501,7 @@ int dasd_ioctl(struct block_device *bdev, fmode_t mode,
>  		if (base->discipline->ioctl) {
>  			rc = base->discipline->ioctl(block, cmd, argp);
>  			if (rc == -ENOIOCTLCMD)
> -				rc = -EINVAL;
> +				rc = -ENOTTY;
>  		} else
>  			rc = -EINVAL;
>  	}

Thanks, but you missed the else path. I'm going to commit the patch below
unless Stefan has any objections:

From dac16bd8b314dc6f3f4e6815feab199fdfc8cddd Mon Sep 17 00:00:00 2001
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Date: Mon, 27 Aug 2012 10:59:42 +0200
Subject: [PATCH] s390/dasd: fix ioctl return value

For unimplemented ioctls the dasd driver should return -ENOTTY.

Reported-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
---
 drivers/s390/block/dasd_eckd.c  | 2 +-
 drivers/s390/block/dasd_ioctl.c | 7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 40a826a..2fb2b9e 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -3804,7 +3804,7 @@ dasd_eckd_ioctl(struct dasd_block *block, unsigned int cmd, void __user *argp)
 	case BIODASDSYMMIO:
 		return dasd_symm_io(device, argp);
 	default:
-		return -ENOIOCTLCMD;
+		return -ENOTTY;
 	}
 }
 
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index cceae70..654c692 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -498,12 +498,9 @@ int dasd_ioctl(struct block_device *bdev, fmode_t mode,
 		break;
 	default:
 		/* if the discipline has an ioctl method try it. */
-		if (base->discipline->ioctl) {
+		rc = -ENOTTY;
+		if (base->discipline->ioctl)
 			rc = base->discipline->ioctl(block, cmd, argp);
-			if (rc == -ENOIOCTLCMD)
-				rc = -EINVAL;
-		} else
-			rc = -EINVAL;
 	}
 	dasd_put_device(base);
 	return rc;
-- 
1.7.11.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 5/5] s390:block:fix up ENOIOCTLCMD error handling
  2012-08-27  9:03   ` Heiko Carstens
@ 2012-08-27 10:25     ` Stefan Weinhuber
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Weinhuber @ 2012-08-27 10:25 UTC (permalink / raw)
  To: heicars2
  Cc: BOEBLINGEN LINUX390, Wanlong Gao, linux-kernel, open list:S390,
	mschwid2

heicars2@linux.vnet.ibm.com wrote on 2012-08-27 11:03:55:

[..]
> 
> Thanks, but you missed the else path. I'm going to commit the patch 
below
> unless Stefan has any objections:
> 
> From dac16bd8b314dc6f3f4e6815feab199fdfc8cddd Mon Sep 17 00:00:00 2001
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
> Date: Mon, 27 Aug 2012 10:59:42 +0200
> Subject: [PATCH] s390/dasd: fix ioctl return value
> 
> For unimplemented ioctls the dasd driver should return -ENOTTY.
> 
> Reported-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
> ---
>  drivers/s390/block/dasd_eckd.c  | 2 +-
>  drivers/s390/block/dasd_ioctl.c | 7 ++-----
>  2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/s390/block/dasd_eckd.c 
b/drivers/s390/block/dasd_eckd.c
> index 40a826a..2fb2b9e 100644
> --- a/drivers/s390/block/dasd_eckd.c
> +++ b/drivers/s390/block/dasd_eckd.c
> @@ -3804,7 +3804,7 @@ dasd_eckd_ioctl(struct dasd_block *block, 
> unsigned int cmd, void __user *argp)
>     case BIODASDSYMMIO:
>        return dasd_symm_io(device, argp);
>     default:
> -      return -ENOIOCTLCMD;
> +      return -ENOTTY;
>     }
>  }
> 
> diff --git a/drivers/s390/block/dasd_ioctl.c 
b/drivers/s390/block/dasd_ioctl.c
> index cceae70..654c692 100644
> --- a/drivers/s390/block/dasd_ioctl.c
> +++ b/drivers/s390/block/dasd_ioctl.c
> @@ -498,12 +498,9 @@ int dasd_ioctl(struct block_device *bdev, fmode_t 
mode,
>        break;
>     default:
>        /* if the discipline has an ioctl method try it. */
> -      if (base->discipline->ioctl) {
> +      rc = -ENOTTY;
> +      if (base->discipline->ioctl)
>           rc = base->discipline->ioctl(block, cmd, argp);
> -         if (rc == -ENOIOCTLCMD)
> -            rc = -EINVAL;
> -      } else
> -         rc = -EINVAL;
>     }
>     dasd_put_device(base);
>     return rc;
> -- 
> 1.7.11.5
> 

The patch is looking fine to me, thanks.

Mit freundlichen Grüßen / Kind regards
 
Stefan Weinhuber

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-08-27 10:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1346052196-32682-1-git-send-email-gaowanlong@cn.fujitsu.com>
2012-08-27  7:23 ` [PATCH 5/5] s390:block:fix up ENOIOCTLCMD error handling Wanlong Gao
2012-08-27  9:03   ` Heiko Carstens
2012-08-27 10:25     ` Stefan Weinhuber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox