Re: [RFC/PATCH 0/5] read/write on attribute w/o show/store should return -ENOSYS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 28 Apr 2005, Dmitry Torokhov wrote:

On 4/28/05, Chris Wright <[email protected]> wrote:
* Greg KH ([email protected]) wrote:
On Thu, Apr 28, 2005 at 12:30:09AM -0500, Dmitry Torokhov wrote:
Hi,

Jean Delvare has noticed that if a driver happens to declare its
attribute as RW but doesn't provide store() method attempt to write
into such attribute will cause spinning process as most of the
attribute implementations return 0 in case of missing store causing
endless retries. In some cases missing show/store will return -EPERM,
-EACCESS or -EINVAL.

I think we should unify implementations and have them all return -ENOSYS
(function not implemented) when corresponding method (show/store) is
missing.

What is the POSIX standard for this?  ENOSYS or EACCESS?

SuSv3 suggests EBADF, however we already do EINVAL at VFS for no write
op.  Although, returning 0 (i.e. wrote zero bytes) is still meaningful
too.


Returning 0 causes caller to immediately repeat operation causing the
loop and 100% CPU utiluization as was reported. If ENOSYS is not
acceptable (after all the problem is sysfs-specific, other fs-es
either support write or they don't for entire volume) I'd say (looking
at the descripptions) we should use ENXIO instead of EBADF:

[ENXIO]
A request was made of a nonexistent device, or the request was outside
the capabilities of the device.

[EBADF]
The fildes argument is not a valid file descriptor open for writing.

We have a valid FD and it was opened for wrinting, so EBADF is not
really applicable. But then I may be talking complete gibberish...

--
Dmitry
-

Perhaps...
ENOSPC, i.e., the device is full. This is the usual return value
for a CD/ROM and `df` always shows it's full even if it has
one small file.

The only thing that really makes sense is EPERM but it is usually
associated with permissions rather than if an operation is permitted.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.11 on an i686 machine (5537.79 BogoMips).
 Notice : All mail here is now cached for review by Dictator Bush.
                 98.36% of all statistics are fiction.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux