Re: [PATCH 2/3] block: fail SCSI passthrough ioctls on partitiondevices

From: Paolo Bonzini
Date: Thu Dec 22 2011 - 17:09:01 EST


On 12/22/2011 09:52 PM, Linus Torvalds wrote:
On Thu, Dec 22, 2011 at 12:23 PM, Paolo Bonzini<pbonzini@xxxxxxxxxx> wrote:

I disagree. ENOTTY is perfect in all cases except the compat_ioctl (which
I'm not denying is ugly, but beautifying it would make everything else
ugly).

No it's not.

ENOTTTY isn't ever perfect. We should never have used it to begin with
inside the kernel.

Why would it make *anything* else uglier? Just return it, don't try to
change it anywhere. Does it break anything?

I don't know. But given the ways in which earlier versions broke during testing, I wouldn't be able to tell before running many tests. Which with the Christmas break would easily mean a little less than 2 weeks.

Secondarily, ENOIOCTLCMD is ultimately turned into EINVAL when the system
call returns (not ENOTTY).

That's a completely independent bug that has been discussed several
times. We probably should just bite the bullet and fix it. EINVAL is
never the right return value (unless the per-ioctl arguments
themselves are invalid, not for bad ioctls).

Makes a lot of sense and I was wondering about it myself, but I'm not sure stable would accept that.

I understand that it's kind of backwards to commit as is and cleanup later, but it's also backwards to force all distros and stable to deviate from upstream for the sake of cleaning up.

The EINVAL return comes from some people who didn't understand that
ENOTTY means "no such ioctl" despite the name.

I did. :)

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/