Messages in this thread Patches in this message | | | Date | Tue, 23 Aug 2005 10:55:58 +0300 | From | Pekka Enberg <> | Subject | Re: sysfs: write returns ENOMEM? |
| |
On 8/23/05, Nathan Scott <nathans@sgi.com> wrote: > FWIW, all filesystems using the generic page cache routines are able > to return this - see mm/filemap.c -> generic_file_buffered_write...
I don't think it makes much sense to fix this in individual filesystems as many functions returning -NOMEM can be used in other paths as well where they're ok.
Andrew, please consider picking this up for -mm. (I've included it as an attachment as well as gmail will surely mess up the patch. Sorry.)
Pekka
[PATCH] VFS: return ENOBUFS instead of ENOMEM for vfs_write()
As noticed by Dmitry Torokhov, write() can not return ENOMEM:
http://www.opengroup.org/onlinepubs/000095399/functions/write.html
Currently almost all filesystems can return -ENOMEM due to generic_file_buffered_write() in mm/filemap.c so filter out the invalid error code in vfs_write().
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> ---
read_write.c | 2 ++ 1 files changed, 2 insertions(+)
Index: 2.6-mm/fs/read_write.c =================================================================== --- 2.6-mm.orig/fs/read_write.c +++ 2.6-mm/fs/read_write.c @@ -310,6 +310,8 @@ ssize_t vfs_write(struct file *file, con } }
+ if (ret == -ENOMEM) + ret = -ENOBUFS; return ret; } [PATCH] VFS: return ENOBUFS instead of ENOMEM for vfs_write()
As noticed by Dmitry Torokhov, write() can not return ENOMEM:
http://www.opengroup.org/onlinepubs/000095399/functions/write.html
Currently almost all filesystems can return -ENOMEM due to generic_file_buffered_write() in mm/filemap.c so filter out the invalid error code in vfs_write().
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> ---
read_write.c | 2 ++ 1 files changed, 2 insertions(+)
Index: 2.6-mm/fs/read_write.c =================================================================== --- 2.6-mm.orig/fs/read_write.c +++ 2.6-mm/fs/read_write.c @@ -310,6 +310,8 @@ ssize_t vfs_write(struct file *file, con } } + if (ret == -ENOMEM) + ret = -ENOBUFS; return ret; } | |