From: Andrew Morton <akpm@zip.com.au>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: [patch 5/13] O_DIRECT open check
Date: Tue, 16 Jul 2002 22:29:44 -0700 [thread overview]
Message-ID: <3D3500C8.9627632F@zip.com.au> (raw)
Updated forward-port of Aodrea's O_DIRECT open() checks. If the user
asked for O_DIRECT and the inode has no mapping or no a_ops then fail
the open up-front.
fcntl.c | 5 ++---
open.c | 7 ++++---
2 files changed, 6 insertions(+), 6 deletions(-)
--- 2.5.26/fs/fcntl.c~o_direct_open_check Tue Jul 16 21:46:32 2002
+++ 2.5.26-akpm/fs/fcntl.c Tue Jul 16 21:59:37 2002
@@ -245,10 +245,9 @@ static int setfl(int fd, struct file * f
}
if (arg & O_DIRECT) {
- if (inode->i_mapping && inode->i_mapping->a_ops) {
- if (!inode->i_mapping->a_ops->direct_IO)
+ if (!inode->i_mapping || !inode->i_mapping->a_ops ||
+ !inode->i_mapping->a_ops->direct_IO)
return -EINVAL;
- }
/*
* alloc_kiovec() can sleep and we are only serialized by
--- 2.5.26/fs/open.c~o_direct_open_check Tue Jul 16 21:46:32 2002
+++ 2.5.26-akpm/fs/open.c Tue Jul 16 21:59:37 2002
@@ -665,10 +665,11 @@ struct file *dentry_open(struct dentry *
/* NB: we're sure to have correct a_ops only after f_op->open */
if (f->f_flags & O_DIRECT) {
- error = -EINVAL;
- if (inode->i_mapping && inode->i_mapping->a_ops)
- if (!inode->i_mapping->a_ops->direct_IO)
+ if (!inode->i_mapping || !inode->i_mapping->a_ops ||
+ !inode->i_mapping->a_ops->direct_IO) {
+ error = -EINVAL;
goto cleanup_all;
+ }
}
return f;
.
reply other threads:[~2002-07-17 5:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3D3500C8.9627632F@zip.com.au \
--to=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.