linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Too verbose compat_ioctl messages?
@ 2007-07-06 12:47 Geert Uytterhoeven
  2007-07-06 12:57 ` Andreas Schwab
  2007-07-06 16:30 ` Too verbose compat_ioctl messages? H. Peter Anvin
  0 siblings, 2 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2007-07-06 12:47 UTC (permalink / raw)
  To: Linux Kernel Development; +Cc: Linux/PPC Development, Hiroaki Fuse

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1992 bytes --]

	Hi,

Fuse-san discovered that running the umount that's part of busybox on a PS3
with a recent kernel causes an error message to be printed on the console:

| ioctl32(busybox:1340): Unknown cmd fd(3) cmd(00004c01){t:'L';sz:0} arg(00000000) on /dev/sda1 

On older kernels (e.g. 2.6.16), this doesn't happen.

It can easily be reproduced by installing busybox and running

| busybox umount /mountpoint

on a mounted filesystem (except when using the loop device).

Apparently Busybox uses the LOOP_CLR_FD ioctl when unmounting a file system,
which is supported by the loop device only.
On other block device types, this ioctl is not supported:
  - With a 64-bit application, the block layer returns ENOTTY (Inappropriate
    ioctl for device), while the SCSI layer returns EINVAL (Invalid argument)
  - With a 32-bit application, the compat_ioctl code returns EINVAL (Invalid
    argument) and prints an error on the console (for the first 50
    occurrencies, cfr. fs/compat_ioctl.c:compat_sys_ioctl())

As I understand, compat_ioctl_error() is used to inform the user about ioctl
values that are not yet handled by the compat_ioctl layer. However, LOOP_CLR_FD
doesn't need to be handled (no data to convert between 32-bit and 64-bit), and
it's perfectly valid for a block device to not implement it.
So it's confusing to print this error message.

Is there anything we can do about this?

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:    +32 (0)2 700 8453	
Fax:      +32 (0)2 700 8622	
E-mail:   Geert.Uytterhoeven@sonycom.com	
Internet: http://www.sony-europe.com/
 	
Sony Network and Software Technology Center Europe	
A division of Sony Service Centre (Europe) N.V.	
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium	
VAT BE 0413.825.160 · RPR Brussels	
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619

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

* Re: Too verbose compat_ioctl messages?
  2007-07-06 12:47 Too verbose compat_ioctl messages? Geert Uytterhoeven
@ 2007-07-06 12:57 ` Andreas Schwab
  2007-07-06 15:49   ` Geert Uytterhoeven
  2007-07-06 15:52   ` [PATCH] compat32: ignore the LOOP_CLR_FD ioctl Geert Uytterhoeven
  2007-07-06 16:30 ` Too verbose compat_ioctl messages? H. Peter Anvin
  1 sibling, 2 replies; 11+ messages in thread
From: Andreas Schwab @ 2007-07-06 12:57 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linux/PPC Development, Linux Kernel Development, Hiroaki Fuse

Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> writes:

> Is there anything we can do about this?

Define it as IGNORE_IOCTL in fs/compat_ioctl.c?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Too verbose compat_ioctl messages?
  2007-07-06 12:57 ` Andreas Schwab
@ 2007-07-06 15:49   ` Geert Uytterhoeven
  2007-07-06 15:52   ` [PATCH] compat32: ignore the LOOP_CLR_FD ioctl Geert Uytterhoeven
  1 sibling, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2007-07-06 15:49 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Linux/PPC Development, Linux Kernel Development, Hiroaki Fuse

[-- Attachment #1: Type: TEXT/PLAIN, Size: 845 bytes --]

On Fri, 6 Jul 2007, Andreas Schwab wrote:
> Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> writes:
> 
> > Is there anything we can do about this?
> 
> Define it as IGNORE_IOCTL in fs/compat_ioctl.c?

Works fine, thx! I'll submit a patch.

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:    +32 (0)2 700 8453	
Fax:      +32 (0)2 700 8622	
E-mail:   Geert.Uytterhoeven@sonycom.com	
Internet: http://www.sony-europe.com/
 	
Sony Network and Software Technology Center Europe	
A division of Sony Service Centre (Europe) N.V.	
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium	
VAT BE 0413.825.160 · RPR Brussels	
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619

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

* [PATCH] compat32: ignore the LOOP_CLR_FD ioctl
  2007-07-06 12:57 ` Andreas Schwab
  2007-07-06 15:49   ` Geert Uytterhoeven
@ 2007-07-06 15:52   ` Geert Uytterhoeven
  1 sibling, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2007-07-06 15:52 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Linux/PPC Development, Adrian 'Trivial' Bunk,
	Linux Kernel Development, Hiroaki Fuse

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1349 bytes --]

compat32: Ignore the LOOP_CLR_FD ioctl for the loop block device, to kill an
annoying kernel message when e.g. busybox umount is used.

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
---
 fs/compat_ioctl.c |    4 ++++
 1 files changed, 4 insertions(+)

--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -63,6 +63,7 @@
 #include <linux/wireless.h>
 #include <linux/atalk.h>
 #include <linux/blktrace_api.h>
+#include <linux/loop.h>
 
 #include <net/bluetooth/bluetooth.h>
 #include <net/bluetooth/hci.h>
@@ -3489,6 +3490,9 @@ HANDLE_IOCTL(LPSETTIMEOUT, lp_timeout_tr
 
 IGNORE_IOCTL(VFAT_IOCTL_READDIR_BOTH32)
 IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32)
+
+/* loop */
+IGNORE_IOCTL(LOOP_CLR_FD)
 };
 
 #define IOCTL_HASHSIZE 256

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:    +32 (0)2 700 8453	
Fax:      +32 (0)2 700 8622	
E-mail:   Geert.Uytterhoeven@sonycom.com	
Internet: http://www.sony-europe.com/
 	
Sony Network and Software Technology Center Europe	
A division of Sony Service Centre (Europe) N.V.	
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium	
VAT BE 0413.825.160 · RPR Brussels	
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619

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

* Re: Too verbose compat_ioctl messages?
  2007-07-06 12:47 Too verbose compat_ioctl messages? Geert Uytterhoeven
  2007-07-06 12:57 ` Andreas Schwab
@ 2007-07-06 16:30 ` H. Peter Anvin
  2007-07-06 18:14   ` Andi Kleen
  1 sibling, 1 reply; 11+ messages in thread
From: H. Peter Anvin @ 2007-07-06 16:30 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linux/PPC Development, Linux Kernel Development, Hiroaki Fuse

Geert Uytterhoeven wrote:
> 
> Fuse-san discovered that running the umount that's part of busybox on a PS3
> with a recent kernel causes an error message to be printed on the console:
> 
> | ioctl32(busybox:1340): Unknown cmd fd(3) cmd(00004c01){t:'L';sz:0} arg(00000000) on /dev/sda1 
> 
> On older kernels (e.g. 2.6.16), this doesn't happen.
> 
> It can easily be reproduced by installing busybox and running
> 
> | busybox umount /mountpoint
> 
> on a mounted filesystem (except when using the loop device).
> 
> Apparently Busybox uses the LOOP_CLR_FD ioctl when unmounting a file system,
> which is supported by the loop device only.
> On other block device types, this ioctl is not supported:
>   - With a 64-bit application, the block layer returns ENOTTY (Inappropriate
>     ioctl for device), while the SCSI layer returns EINVAL (Invalid argument)
>   - With a 32-bit application, the compat_ioctl code returns EINVAL (Invalid
>     argument) and prints an error on the console (for the first 50
>     occurrencies, cfr. fs/compat_ioctl.c:compat_sys_ioctl())
> 
> As I understand, compat_ioctl_error() is used to inform the user about ioctl
> values that are not yet handled by the compat_ioctl layer. However, LOOP_CLR_FD
> doesn't need to be handled (no data to convert between 32-bit and 64-bit), and
> it's perfectly valid for a block device to not implement it.
> So it's confusing to print this error message.
> 
> Is there anything we can do about this?
> 

For one thing, it looks like we're returning the wrong thing (EINVAL
rather than ENOTTY) across the board.  This was unfortunately a common
misunderstanding with non-tty-related ioctls in the early days of Linux.

	-hpa

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

* Re: Too verbose compat_ioctl messages?
  2007-07-06 18:14   ` Andi Kleen
@ 2007-07-06 17:48     ` H. Peter Anvin
  2007-07-06 18:33     ` Jeremy Fitzhardinge
  1 sibling, 0 replies; 11+ messages in thread
From: H. Peter Anvin @ 2007-07-06 17:48 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Geert Uytterhoeven, Linux/PPC Development,
	Linux Kernel Development, Hiroaki Fuse

Andi Kleen wrote:
> "H. Peter Anvin" <hpa@zytor.com> writes:
>> For one thing, it looks like we're returning the wrong thing (EINVAL
>> rather than ENOTTY) across the board.  This was unfortunately a common
>> misunderstanding with non-tty-related ioctls in the early days of Linux.
> 
> ENOTTY is so excessively misnamed that it is actually surprising
> anybody ever got that "right" (for very small values of right i guess)
> 

No argument there.

	-hpa

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

* Re: Too verbose compat_ioctl messages?
  2007-07-06 16:30 ` Too verbose compat_ioctl messages? H. Peter Anvin
@ 2007-07-06 18:14   ` Andi Kleen
  2007-07-06 17:48     ` H. Peter Anvin
  2007-07-06 18:33     ` Jeremy Fitzhardinge
  0 siblings, 2 replies; 11+ messages in thread
From: Andi Kleen @ 2007-07-06 18:14 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Geert Uytterhoeven, Linux/PPC Development,
	Linux Kernel Development, Hiroaki Fuse

"H. Peter Anvin" <hpa@zytor.com> writes:
> 
> For one thing, it looks like we're returning the wrong thing (EINVAL
> rather than ENOTTY) across the board.  This was unfortunately a common
> misunderstanding with non-tty-related ioctls in the early days of Linux.

ENOTTY is so excessively misnamed that it is actually surprising
anybody ever got that "right" (for very small values of right i guess)

-Andi

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

* Re: Too verbose compat_ioctl messages?
  2007-07-06 18:14   ` Andi Kleen
  2007-07-06 17:48     ` H. Peter Anvin
@ 2007-07-06 18:33     ` Jeremy Fitzhardinge
  2007-07-06 18:36       ` H. Peter Anvin
  2007-07-06 19:04       ` Andi Kleen
  1 sibling, 2 replies; 11+ messages in thread
From: Jeremy Fitzhardinge @ 2007-07-06 18:33 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Geert Uytterhoeven, Linux/PPC Development,
	Linux Kernel Development, Hiroaki Fuse, H. Peter Anvin

Andi Kleen wrote:
> "H. Peter Anvin" <hpa@zytor.com> writes:
>   
>> For one thing, it looks like we're returning the wrong thing (EINVAL
>> rather than ENOTTY) across the board.  This was unfortunately a common
>> misunderstanding with non-tty-related ioctls in the early days of Linux.
>>     
>
> ENOTTY is so excessively misnamed that it is actually surprising
> anybody ever got that "right" (for very small values of right i guess)
>   

But it *isn't* a typewriter.  Of course, it's not a giraffe either.

    J

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

* Re: Too verbose compat_ioctl messages?
  2007-07-06 18:33     ` Jeremy Fitzhardinge
@ 2007-07-06 18:36       ` H. Peter Anvin
  2007-07-06 18:40         ` Jeremy Fitzhardinge
  2007-07-06 19:04       ` Andi Kleen
  1 sibling, 1 reply; 11+ messages in thread
From: H. Peter Anvin @ 2007-07-06 18:36 UTC (permalink / raw)
  To: Jeremy Fitzhardinge
  Cc: Geert Uytterhoeven, Linux/PPC Development, Andi Kleen,
	Linux Kernel Development, Hiroaki Fuse

Jeremy Fitzhardinge wrote:
>>
>> ENOTTY is so excessively misnamed that it is actually surprising
>> anybody ever got that "right" (for very small values of right i guess)
> 
> But it *isn't* a typewriter.  Of course, it's not a giraffe either.
> 

The union of things that are not typewriters and not giraffes are rather
large, indeed.

This is getting philosophical.

	-hpa

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

* Re: Too verbose compat_ioctl messages?
  2007-07-06 18:36       ` H. Peter Anvin
@ 2007-07-06 18:40         ` Jeremy Fitzhardinge
  0 siblings, 0 replies; 11+ messages in thread
From: Jeremy Fitzhardinge @ 2007-07-06 18:40 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Geert Uytterhoeven, Linux/PPC Development, Andi Kleen,
	Linux Kernel Development, Hiroaki Fuse

H. Peter Anvin wrote:
> The union of things that are not typewriters and not giraffes are rather
> large, indeed.
>
> This is getting philosophical.
>   

I think my point is that we're rather short of good quality open source 
giraffe drivers.

    J

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

* Re: Too verbose compat_ioctl messages?
  2007-07-06 18:33     ` Jeremy Fitzhardinge
  2007-07-06 18:36       ` H. Peter Anvin
@ 2007-07-06 19:04       ` Andi Kleen
  1 sibling, 0 replies; 11+ messages in thread
From: Andi Kleen @ 2007-07-06 19:04 UTC (permalink / raw)
  To: Jeremy Fitzhardinge
  Cc: Linux Kernel Development, Linux/PPC Development, Andi Kleen,
	H. Peter Anvin, Geert Uytterhoeven, Hiroaki Fuse

On Fri, Jul 06, 2007 at 11:33:43AM -0700, Jeremy Fitzhardinge wrote:
> Andi Kleen wrote:
> >"H. Peter Anvin" <hpa@zytor.com> writes:
> >  
> >>For one thing, it looks like we're returning the wrong thing (EINVAL
> >>rather than ENOTTY) across the board.  This was unfortunately a common
> >>misunderstanding with non-tty-related ioctls in the early days of Linux.
> >>    
> >
> >ENOTTY is so excessively misnamed that it is actually surprising
> >anybody ever got that "right" (for very small values of right i guess)
> >  
> 
> But it *isn't* a typewriter. 

Most ioctls are not related to ttys in any way.

-Andi

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

end of thread, other threads:[~2007-07-06 19:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-06 12:47 Too verbose compat_ioctl messages? Geert Uytterhoeven
2007-07-06 12:57 ` Andreas Schwab
2007-07-06 15:49   ` Geert Uytterhoeven
2007-07-06 15:52   ` [PATCH] compat32: ignore the LOOP_CLR_FD ioctl Geert Uytterhoeven
2007-07-06 16:30 ` Too verbose compat_ioctl messages? H. Peter Anvin
2007-07-06 18:14   ` Andi Kleen
2007-07-06 17:48     ` H. Peter Anvin
2007-07-06 18:33     ` Jeremy Fitzhardinge
2007-07-06 18:36       ` H. Peter Anvin
2007-07-06 18:40         ` Jeremy Fitzhardinge
2007-07-06 19:04       ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).