Re: sysfs: write returns ENOMEM?
From: Pekka Enberg
Date: Tue Aug 23 2005 - 02:56:27 EST
On 8/23/05, Nathan Scott <nathans@xxxxxxx> 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@xxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxx>
---
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;
}