public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Roland Dreier <rdreier@cisco.com>
Cc: Davide Libenzi <davidel@xmailserver.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] anonfd: Make file read-only if fops->write is not set
Date: Fri, 18 Dec 2009 06:10:49 +0000	[thread overview]
Message-ID: <20091218061049.GI18217@ZenIV.linux.org.uk> (raw)
In-Reply-To: <adaws0k3kd8.fsf@roland-alpha.cisco.com>

On Thu, Dec 17, 2009 at 09:46:11PM -0800, Roland Dreier wrote:
> diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
> index 2c99459..097f91f 100644
> --- a/fs/anon_inodes.c
> +++ b/fs/anon_inodes.c
> @@ -121,13 +121,13 @@ struct file *anon_inode_getfile(const char *name,
>  	d_instantiate(path.dentry, anon_inode_inode);
>  
>  	error = -ENFILE;
> -	file = alloc_file(&path, FMODE_READ | FMODE_WRITE, fops);
> +	file = alloc_file(&path, FMODE_READ | (fops->write ? FMODE_WRITE : 0), fops);

Good grief, what for?  We are already passing O_NDELAY in flags argument,
why not add O_RDWR/O_RDONLY to it?  It's not as if we had that many
callers, after all...

  reply	other threads:[~2009-12-18  6:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-18  5:46 [PATCH] anonfd: Make file read-only if fops->write is not set Roland Dreier
2009-12-18  6:10 ` Al Viro [this message]
2009-12-18 17:12   ` Davide Libenzi
2009-12-18 17:41   ` [PATCH v2] " Roland Dreier
2009-12-18 18:59     ` Davide Libenzi
2009-12-18 19:14       ` Al Viro

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=20091218061049.GI18217@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdreier@cisco.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox