public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue@us.ibm.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	hch@infradead.org
Subject: Re: missing mnt_drop_write() on open error
Date: Wed, 26 Sep 2007 11:08:55 -0700	[thread overview]
Message-ID: <1190830135.30530.32.camel@localhost> (raw)
In-Reply-To: <E1Iab1W-0005Ye-00@dorka.pomaz.szeredi.hu>

On Wed, 2007-09-26 at 19:50 +0200, Miklos Szeredi wrote:
> Maybe.  Can we do the mnt_want_write() from __dentry_open(), instead
> of may_open()?  That would be a lot cleaner.

I'll explore that.  It may make very good sense.

> Btw, may_open() doesn't do mnt_want_write() around the truncation if
> file is opened with O_TRUNC | O_RDONLY.

What's the path to may_open() in that case?  open_namei() should wrap
all callers other than nfs, and it does:

	/* O_TRUNC implies we need access checks for write permissions */
        if (flag & O_TRUNC)
                acc_mode |= MAY_WRITE;

Which should trigger the may_open() code.  

later in open_namei():
...
ok:
        error = may_open(nd, acc_mode, flag);
        if (error)
                goto exit;
        return 0;


-- Dave


  reply	other threads:[~2007-09-26 18:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-25 23:14 missing mnt_drop_write() on open error Miklos Szeredi
2007-09-25 23:24 ` Dave Hansen
2007-09-26  1:21 ` Dave Hansen
2007-09-26  8:38   ` Miklos Szeredi
2007-09-26 15:07     ` Christoph Hellwig
2007-09-26 16:14     ` Dave Hansen
2007-09-26 16:19     ` Dave Hansen
2007-09-26 17:50       ` Miklos Szeredi
2007-09-26 18:08         ` Dave Hansen [this message]
2007-09-26 18:54           ` Miklos Szeredi

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=1190830135.30530.32.camel@localhost \
    --to=haveblue@us.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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