From: Alan Cox <alan@redhat.com>

The block layer checks for -EINVAL from block layer driver ioctls.  This is
wrong - ENOTTY is unknown and some drivers correctly use this.  I suspect
for an internal ioctl 2.7 should change to -ENOIOCTLCMD and bitch about old
style returns

This is conservative fix for the 2.6 case, it keeps the bogus -EINVAL to
avoid breaking stuff


---

 25-akpm/drivers/block/ioctl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN drivers/block/ioctl.c~fix-block-layer-ioctl-bug drivers/block/ioctl.c
--- 25/drivers/block/ioctl.c~fix-block-layer-ioctl-bug	Wed May 12 15:20:28 2004
+++ 25-akpm/drivers/block/ioctl.c	Wed May 12 15:20:28 2004
@@ -203,7 +203,8 @@ int blkdev_ioctl(struct inode *inode, st
 	case BLKROSET:
 		if (disk->fops->ioctl) {
 			ret = disk->fops->ioctl(inode, file, cmd, arg);
-			if (ret != -EINVAL)
+			/* -EINVAL to handle old uncorrected drivers */
+			if (ret != -EINVAL && ret != -ENOTTY)
 				return ret;
 		}
 		if (!capable(CAP_SYS_ADMIN))

_