Re: sysfs: write returns ENOMEM?

Nathan Scott
2005-08-23T07:41:39Z

> On 8/19/05, Dmitry Torokhov <dtor_core@ameritech.net> wrote:
> > According to the SuS write() can not return ENOMEM, only ENOBUFS is allowed
> > (surprisingly read() is allowed to use both ENOMEM and ENOBUFS):
> >
> > http://www.opengroup.org/onlinepubs/000095399/functions/write.html
> >
> > Should we adjust sysfs write to follow the standard?
>
> Please note that sysfs is not the only one to do this. A quick peek
> reveals XFS and CIFS returing ENOMEM for write() and there are
> probably others as well. Perhaps we should replace ENOMEM with ENOBUFS

FWIW, all filesystems using the generic page cache routines are able
to return this - see mm/filemap.c -> generic_file_buffered_write...

page = __grab_cache_page(mapping,index,&cached_page,&lru_pvec);
if (!page) {
status = -ENOMEM;
break;
}

which is a similar condition to the one under which the XFS code is
returning this error. Let me know what the verdict is and I'll get
the XFS side of this merged if its really necessary.

cheers.

--
Nathan