From: Pekka Enberg <penberg@gmail.com>
To: Nathan Scott <nathans@sgi.com>
Cc: Dmitry Torokhov <dtor_core@ameritech.net>,
linux-kernel@vger.kernel.org, Greg KH <greg@kroah.com>,
Andrew Morton <akpm@osdl.org>,
Christoph Hellwig <hch@infradead.org>,
Pekka Enberg <penberg@cs.helsinki.fi>
Subject: Re: sysfs: write returns ENOMEM?
Date: Tue, 23 Aug 2005 10:55:58 +0300 [thread overview]
Message-ID: <84144f02050823005573569fcb@mail.gmail.com> (raw)
In-Reply-To: <20050823073258.GE743@frodo>
[-- Attachment #1: Type: text/plain, Size: 1373 bytes --]
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;
}
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vfs-vfs_write-return-ENOBUFS-instead-ENOMEM.patch --]
[-- Type: text/x-patch; name="vfs-vfs_write-return-ENOBUFS-instead-ENOMEM.patch", Size: 759 bytes --]
[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;
}
next prev parent reply other threads:[~2005-08-23 7:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <11394.1124781401@kao2.melbourne.sgi.com>
2005-08-19 5:55 ` sysfs: write returns ENOMEM? Dmitry Torokhov
2005-08-19 7:29 ` Greg KH
2005-08-19 7:39 ` Pekka Enberg
2005-08-23 7:32 ` Nathan Scott
2005-08-23 7:55 ` Pekka Enberg [this message]
2005-08-23 8:28 ` Andrew Morton
2005-08-23 8:36 ` Pekka J Enberg
2005-08-23 8:46 ` [PATCH] mm: return ENOBUFS instead of ENOMEM in generic_file_buffered_write Pekka J Enberg
2005-08-23 11:55 ` Christoph Hellwig
2005-08-23 13:50 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84144f02050823005573569fcb@mail.gmail.com \
--to=penberg@gmail.com \
--cc=akpm@osdl.org \
--cc=dtor_core@ameritech.net \
--cc=greg@kroah.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathans@sgi.com \
--cc=penberg@cs.helsinki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox