All of lore.kernel.org
 help / color / mirror / Atom feed
* libata:  BLKFLSBUF ioctl broken
@ 2004-10-21 21:04 Mark Lord
  2004-10-22  4:04 ` Jeff Garzik
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Lord @ 2004-10-21 21:04 UTC (permalink / raw)
  To: linux-scsi

Like the subject line says.. BLKFLSBUF (and friends) are broken for SATA.
I'm getting tons of emails about this now that 2.6.9 is out.

Jeff: any chance of you fixing this soon?

Cheers
-- 
Mark Lord
(hdparm keeper & the original "Linux IDE Guy")

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

* Re: libata:  BLKFLSBUF ioctl broken
  2004-10-21 21:04 libata: BLKFLSBUF ioctl broken Mark Lord
@ 2004-10-22  4:04 ` Jeff Garzik
  2004-10-22 14:20   ` Mark Lord
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff Garzik @ 2004-10-22  4:04 UTC (permalink / raw)
  To: Mark Lord; +Cc: linux-scsi

On Thu, Oct 21, 2004 at 05:04:14PM -0400, Mark Lord wrote:
> Like the subject line says.. BLKFLSBUF (and friends) are broken for SATA.
> I'm getting tons of emails about this now that 2.6.9 is out.
> 
> Jeff: any chance of you fixing this soon?

More details...  define broken.

libata doesn't handle BLKFLSBUF directly, and never has, 
so nothing changed in that regard for 2.6.9.

	Jeff




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

* Re: libata:  BLKFLSBUF ioctl broken
  2004-10-22  4:04 ` Jeff Garzik
@ 2004-10-22 14:20   ` Mark Lord
  2004-10-22 17:07     ` [PATCH] " Jeff Garzik
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Lord @ 2004-10-22 14:20 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-scsi

Try issuing a BLKFLSBUF to a SATA drive.
As of 2.6.9 this apparently returns EOPNOTSUPP to userspace.

I don't have any libata controllers here to try it with.
-- 
Mark Lord
(hdparm keeper & the original "Linux IDE Guy")

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

* Re: [PATCH] Re: libata:  BLKFLSBUF ioctl broken
  2004-10-22 17:07     ` [PATCH] " Jeff Garzik
@ 2004-10-22 16:14       ` Alan Cox
  2004-10-22 17:20         ` Jeff Garzik
  0 siblings, 1 reply; 12+ messages in thread
From: Alan Cox @ 2004-10-22 16:14 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Mark Lord, linux-scsi, Jens Axboe

On Gwe, 2004-10-22 at 18:07, Jeff Garzik wrote:
> Ok, I think I see what's going on.  Can you get your users to try the 
> attached patch?

This patch is definitely wrong.

> Maybe libata should be returning ENOTTY, but that's _quite_ nonsensical 
> considering that EOPNOTSUPP describes the error much better (and is a 
> standard I-don't-support-that-operation return code in tons of other 
> Linux ioctl-handling code).

libata should be returning -ENOTTY "I don't know what you are talking
about", and the core block layer will then fallback and do generic
handling

-EOPNOTSUPP is saying "I do know what is going on but its broken so
fail it totally".



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

* [PATCH] Re: libata:  BLKFLSBUF ioctl broken
  2004-10-22 14:20   ` Mark Lord
@ 2004-10-22 17:07     ` Jeff Garzik
  2004-10-22 16:14       ` Alan Cox
  0 siblings, 1 reply; 12+ messages in thread
From: Jeff Garzik @ 2004-10-22 17:07 UTC (permalink / raw)
  To: Mark Lord; +Cc: linux-scsi, Jens Axboe, Alan Cox

[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]

Mark Lord wrote:
> Try issuing a BLKFLSBUF to a SATA drive.
> As of 2.6.9 this apparently returns EOPNOTSUPP to userspace.

Ok, I think I see what's going on.  Can you get your users to try the 
attached patch?

Maybe libata should be returning ENOTTY, but that's _quite_ nonsensical 
considering that EOPNOTSUPP describes the error much better (and is a 
standard I-don't-support-that-operation return code in tons of other 
Linux ioctl-handling code).


> I don't have any libata controllers here to try it with.

You mean you don't have an Intel PATA controller lying around 
anywhere???  :)  To enable Intel PATA controllers, set the 
ATA_ENABLE_PATA define in include/linux/libata.h, and recompile the 
ata_piix driver:

#undef ATA_DEBUG                /* debugging output */
#undef ATA_VERBOSE_DEBUG        /* yet more debugging output */
#undef ATA_IRQ_TRAP             /* define to ack screaming irqs */
#undef ATA_NDEBUG               /* define to disable quick runtime checks */
#undef ATA_ENABLE_ATAPI         /* define to enable ATAPI support */
#undef ATA_ENABLE_PATA          /* define to enable PATA support in some
                                  * low-level drivers */
#undef ATAPI_ENABLE_DMADIR      /* enables ATAPI DMADIR bridge support */

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 476 bytes --]

===== drivers/block/ioctl.c 1.62 vs edited =====
--- 1.62/drivers/block/ioctl.c	2004-10-03 00:05:10 -04:00
+++ edited/drivers/block/ioctl.c	2004-10-22 13:06:16 -04:00
@@ -195,7 +195,8 @@
 		if (disk->fops->ioctl) {
 			ret = disk->fops->ioctl(inode, file, cmd, arg);
 			/* -EINVAL to handle old uncorrected drivers */
-			if (ret != -EINVAL && ret != -ENOTTY)
+			if (ret != -EINVAL && ret != -ENOTTY &&
+			    ret != -EOPNOTSUPP)
 				return ret;
 		}
 		fsync_bdev(bdev);

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

* Re: [PATCH] Re: libata:  BLKFLSBUF ioctl broken
  2004-10-22 16:14       ` Alan Cox
@ 2004-10-22 17:20         ` Jeff Garzik
  2004-10-22 17:40           ` Mark Lord
  2004-10-22 18:16           ` Alan Cox
  0 siblings, 2 replies; 12+ messages in thread
From: Jeff Garzik @ 2004-10-22 17:20 UTC (permalink / raw)
  To: Alan Cox; +Cc: Mark Lord, linux-scsi, Jens Axboe

Alan Cox wrote:
> libata should be returning -ENOTTY "I don't know what you are talking
> about", and the core block layer will then fallback and do generic
> handling
> 
> -EOPNOTSUPP is saying "I do know what is going on but its broken so
> fail it totally".

Are you describing behavior mandated in some standard?

Because that differs with _tons_ of existing ioctl code, whose default 
return code is EOPNOTSUPP when no known operation is found in a C 
"switch(cmd)" statement.

grep for it...

	Jeff



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

* Re: [PATCH] Re: libata:  BLKFLSBUF ioctl broken
  2004-10-22 17:20         ` Jeff Garzik
@ 2004-10-22 17:40           ` Mark Lord
  2004-10-22 18:16           ` Alan Cox
  1 sibling, 0 replies; 12+ messages in thread
From: Mark Lord @ 2004-10-22 17:40 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Alan Cox, linux-scsi, Jens Axboe

The best I can find (with a quick google) is:

http://www.opengroup.org/onlinepubs/009695399/basedefs/errno.h.html

[ENOTTY]
     Inappropriate I/O control operation.
[EOPNOTSUPP]
     Operation not supported on socket.

Cheers
-- 
Mark Lord
(hdparm keeper & the original "Linux IDE Guy")

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

* Re: [PATCH] Re: libata:  BLKFLSBUF ioctl broken
  2004-10-22 17:20         ` Jeff Garzik
  2004-10-22 17:40           ` Mark Lord
@ 2004-10-22 18:16           ` Alan Cox
  2004-10-22 19:42             ` Doug Maxey
  2004-10-22 20:58             ` Bryan Henderson
  1 sibling, 2 replies; 12+ messages in thread
From: Alan Cox @ 2004-10-22 18:16 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Mark Lord, linux-scsi, Jens Axboe

On Gwe, 2004-10-22 at 18:20, Jeff Garzik wrote:
> > -EOPNOTSUPP is saying "I do know what is going on but its broken so
> > fail it totally".
> 
> Are you describing behavior mandated in some standard?

Yes. ENOTTY means "the ioctl you threw at me isn't one I understand",
always has been in Unix proper.

-EINVAL: "I recognize this ioctl but the arguments are bogus"
-ENOTTY: "I don't recognize this ioctl at all"
-ENOIOCTLCMD: Internal (never user visible) used by some driver layers 
to pass down "please do the defaults". This one might be a sane addition
to the block layer list.

> Because that differs with _tons_ of existing ioctl code, whose default 
> return code is EOPNOTSUPP when no known operation is found in a C 
> "switch(cmd)" statement.
> 
> grep for it...

We are slowly fixing the abusers of -EINVAL/-EOPNOTSUPP. Note btw that
networking stuff is in many places a little different in its returns.

Alan


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

* Re: [PATCH] Re: libata: BLKFLSBUF ioctl broken
  2004-10-22 18:16           ` Alan Cox
@ 2004-10-22 19:42             ` Doug Maxey
  2004-10-22 20:31               ` Alan Cox
  2004-10-25 20:24               ` Bryan Henderson
  2004-10-22 20:58             ` Bryan Henderson
  1 sibling, 2 replies; 12+ messages in thread
From: Doug Maxey @ 2004-10-22 19:42 UTC (permalink / raw)
  To: Alan Cox; +Cc: Jeff Garzik, Mark Lord, linux-scsi, Jens Axboe


On Fri, 22 Oct 2004 19:16:59 BST, Alan Cox wrote:
>On Gwe, 2004-10-22 at 18:20, Jeff Garzik wrote:
>> > -EOPNOTSUPP is saying "I do know what is going on but its broken so
>> > fail it totally".
>> 
>> Are you describing behavior mandated in some standard?
>
>Yes. ENOTTY means "the ioctl you threw at me isn't one I understand",
>always has been in Unix proper.
>
>-EINVAL: "I recognize this ioctl but the arguments are bogus"
>-ENOTTY: "I don't recognize this ioctl at all"
>-ENOIOCTLCMD: Internal (never user visible) used by some driver layers 
>to pass down "please do the defaults". This one might be a sane addition
>to the block layer list.
>
>> Because that differs with _tons_ of existing ioctl code, whose default 
>> return code is EOPNOTSUPP when no known operation is found in a C 
>> "switch(cmd)" statement.
>> 
>> grep for it...
>
>We are slowly fixing the abusers of -EINVAL/-EOPNOTSUPP. Note btw that
>networking stuff is in many places a little different in its returns.

What about the case of "This is normally a valid command, but this
particulat device is incapable of this particular subcommand"?

Hypothetical instance: a disk drive that indicates it is not capable of 
changing it's write cache setting?


>
>Alan
>
>-
>To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



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

* Re: [PATCH] Re: libata: BLKFLSBUF ioctl broken
  2004-10-22 19:42             ` Doug Maxey
@ 2004-10-22 20:31               ` Alan Cox
  2004-10-25 20:24               ` Bryan Henderson
  1 sibling, 0 replies; 12+ messages in thread
From: Alan Cox @ 2004-10-22 20:31 UTC (permalink / raw)
  To: Doug Maxey; +Cc: Jeff Garzik, Mark Lord, linux-scsi, Jens Axboe

On Gwe, 2004-10-22 at 20:42, Doug Maxey wrote:
> >We are slowly fixing the abusers of -EINVAL/-EOPNOTSUPP. Note btw that
> >networking stuff is in many places a little different in its returns.
> 
> What about the case of "This is normally a valid command, but this
> particulat device is incapable of this particular subcommand"?
> 
> Hypothetical instance: a disk drive that indicates it is not capable of 
> changing it's write cache setting?

Thats less clear. Traditional Unix has tended to use EINVAL for that
too, while Linux re-uses things like EOPNOTSUPP and that may well be a
better approach - its at least fairly consistent in Linux.


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

* Re: [PATCH] Re: libata:  BLKFLSBUF ioctl broken
  2004-10-22 18:16           ` Alan Cox
  2004-10-22 19:42             ` Doug Maxey
@ 2004-10-22 20:58             ` Bryan Henderson
  1 sibling, 0 replies; 12+ messages in thread
From: Bryan Henderson @ 2004-10-22 20:58 UTC (permalink / raw)
  To: Alan Cox; +Cc: Jens Axboe, Jeff Garzik, linux-scsi, linux-scsi-owner, Mark Lord

>-EINVAL: "I recognize this ioctl but the arguments are bogus"
>-ENOTTY: "I don't recognize this ioctl at all"

You mean of course "this ioctl command code."

--
Bryan Henderson                          IBM Almaden Research Center
San Jose CA                              Filesystems

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

* Re: [PATCH] Re: libata: BLKFLSBUF ioctl broken
  2004-10-22 19:42             ` Doug Maxey
  2004-10-22 20:31               ` Alan Cox
@ 2004-10-25 20:24               ` Bryan Henderson
  1 sibling, 0 replies; 12+ messages in thread
From: Bryan Henderson @ 2004-10-25 20:24 UTC (permalink / raw)
  To: Doug Maxey; +Cc: Alan Cox, Jens Axboe, Jeff Garzik, linux-scsi, Mark Lord

>What about the case of "This is normally a valid command, but this
>particulat device is incapable of this particular subcommand"?
>
>Hypothetical instance: a disk drive that indicates it is not capable of 
>changing it's write cache setting?

I believe there is a fundamental difference between "A device of this kind 
can't do that" and "that doesn't make any sense for a device of this 
kind."  It's the difference between a request to boil the ocean and a 
request to boil Christmas.  ENOTTY is for the request to boil Christmas. 
If you look at the history (from when it just meant "hey, this isn't a 
terminal (tty)"), it's clear:  An ioctl to set the backspace character on 
a disk drive isn't impossible -- it's nonsensical.

--
Bryan Henderson                          IBM Almaden Research Center
San Jose CA                              Filesystems

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

end of thread, other threads:[~2004-10-25 20:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-21 21:04 libata: BLKFLSBUF ioctl broken Mark Lord
2004-10-22  4:04 ` Jeff Garzik
2004-10-22 14:20   ` Mark Lord
2004-10-22 17:07     ` [PATCH] " Jeff Garzik
2004-10-22 16:14       ` Alan Cox
2004-10-22 17:20         ` Jeff Garzik
2004-10-22 17:40           ` Mark Lord
2004-10-22 18:16           ` Alan Cox
2004-10-22 19:42             ` Doug Maxey
2004-10-22 20:31               ` Alan Cox
2004-10-25 20:24               ` Bryan Henderson
2004-10-22 20:58             ` Bryan Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.