archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <>
To: Al Viro <>
Cc: linux-fsdevel <>,
	Miklos Szeredi <>
Subject: Re: [PATCH][RFC] ovl_create_real(): make it cope with vfs_mkdir() safely
Date: Sat, 12 May 2018 11:55:28 +0300	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

On Sat, May 12, 2018 at 8:13 AM, Amir Goldstein <> wrote:
> On Sat, May 12, 2018 at 4:29 AM, Al Viro <> wrote:
>> [this one really, really needs a review by overlayfs folks;
>> all I can promise is that it compiles.]
>> vfs_mkdir() may succeed and leave the dentry passed to it unhashed and
>> negative.  ovl_create_real() is the last caller breaking when that
>> happens.
>> Make ovl_create_real() return the dentry to be used or ERR_PTR(-E...)
>> in case of error; usually that'll be the dentry passed to it, but
>> it might be a different one - result of lookup in case of vfs_mkdir()
>> leaving looking the inode, etc. up to the next lookup to come.
>> In that case (as well as in case of an error), original dentry is
>> dropped.  That simplifies the callers.  Moreover, passing ERR_PTR()
>> as dentry leads to immediate return of the same ERR_PTR().  That
>> simplifies the callers even more.
> So in the beginning I had mixed feelings about the internal interface
> change.. it feels shady, but it does simplify the callers... but then
> I realized the correct way to simplify the callers would be a helper
> ovl_create_real_temp(), because in most of the call sites
> ovl_lookup_temp() is the argument to ovl_create_real(), so
> your patch shouldn't bother with it.
> With that in mind, I think your mkdir fix should go into ovl_do_mkdir(),
> hopefully, calling a vfs helper vfs_mkdir_hashed(), where all
> of the above, including ovl_create_real() pass in a struct dentry **
> I can prep and test the ovl patches if you like.

My tested version is at:

The branch is based on a merge of your vfs/fixes and Miklos'
vfs/overlayfs-rorw branches. It includes also a patch for overlayfs
to use d_instantiate_new().

Will post the patches to overlayfs list shortly.


  reply	other threads:[~2018-05-12  8:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-12  1:25 [RFC][PATCH] ovl_create_index(): vfs_mkdir() might succeed leaving dentry negative unhashed Al Viro
2018-05-12  1:29 ` [PATCH][RFC] ovl_create_real(): make it cope with vfs_mkdir() safely Al Viro
2018-05-12  5:13   ` Amir Goldstein
2018-05-12  8:55     ` Amir Goldstein [this message]
2018-05-12  4:49 ` [RFC][PATCH] ovl_create_index(): vfs_mkdir() might succeed leaving dentry negative unhashed Amir Goldstein
2018-05-13 22:50   ` Al Viro
2018-05-14 15:04 ` Miklos Szeredi
2018-05-14 15:39   ` 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).