linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: neil@brown.name
Cc: Christian Brauner <brauner@kernel.org>,
	Amir Goldstein <amir73il@gmail.com>,
	Jeff Layton <jlayton@kernel.org>, Jan Kara <jack@suse.cz>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 1/7] VFS/ovl: add lookup_one_positive_killable()
Date: Thu, 11 Sep 2025 21:05:59 +0100	[thread overview]
Message-ID: <20250911200559.GW39973@ZenIV> (raw)
In-Reply-To: <20250909044637.705116-2-neilb@ownmail.net>

On Tue, Sep 09, 2025 at 02:43:15PM +1000, NeilBrown wrote:

> Note that instead of always getting an exclusive lock, ovl now only gets
> a shared lock, and only sometimes.  The exclusive lock was never needed.

what it is the locking environment in callers and what stabilizes
that list hanging off rdd, seeing that you now run through it without
having dir held exclusive?

> -	int err;
> +	int err = 0;
>  	struct dentry *dentry, *dir = path->dentry;
>  	const struct cred *old_cred;
>  
>  	old_cred = ovl_override_creds(rdd->dentry->d_sb);
>  
> -	err = down_write_killable(&dir->d_inode->i_rwsem);
> -	if (!err) {
> -		while (rdd->first_maybe_whiteout) {
> -			struct ovl_cache_entry *p =
> -				rdd->first_maybe_whiteout;
> -			rdd->first_maybe_whiteout = p->next_maybe_whiteout;
> -			dentry = lookup_one(mnt_idmap(path->mnt),
> -					    &QSTR_LEN(p->name, p->len), dir);
> -			if (!IS_ERR(dentry)) {
> -				p->is_whiteout = ovl_is_whiteout(dentry);
> -				dput(dentry);
> -			}
> +	while (rdd->first_maybe_whiteout) {
> +		struct ovl_cache_entry *p =
> +			rdd->first_maybe_whiteout;
> +		rdd->first_maybe_whiteout = p->next_maybe_whiteout;
> +		dentry = lookup_one_positive_killable(mnt_idmap(path->mnt),
> +						      &QSTR_LEN(p->name, p->len),
> +						      dir);
> +		if (!IS_ERR(dentry)) {
> +			p->is_whiteout = ovl_is_whiteout(dentry);
> +			dput(dentry);
> +		} else if (PTR_ERR(dentry) == -EINTR) {
> +			err = -EINTR;
> +			break;
>  		}
> -		inode_unlock(dir->d_inode);
>  	}
>  	ovl_revert_creds(old_cred);
>  
> diff --git a/include/linux/namei.h b/include/linux/namei.h
> index 5d085428e471..551a1a01e5e7 100644
> --- a/include/linux/namei.h
> +++ b/include/linux/namei.h
> @@ -80,6 +80,9 @@ struct dentry *lookup_one_unlocked(struct mnt_idmap *idmap,
>  struct dentry *lookup_one_positive_unlocked(struct mnt_idmap *idmap,
>  					    struct qstr *name,
>  					    struct dentry *base);
> +struct dentry *lookup_one_positive_killable(struct mnt_idmap *idmap,
> +					    struct qstr *name,
> +					    struct dentry *base);
>  
>  extern int follow_down_one(struct path *);
>  extern int follow_down(struct path *path, unsigned int flags);
> -- 
> 2.50.0.107.gf914562f5916.dirty
> 

  reply	other threads:[~2025-09-11 20:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09  4:43 [PATCH v2 0/8] VFS: more prep for change to directory locking NeilBrown
2025-09-09  4:43 ` [PATCH v2 1/7] VFS/ovl: add lookup_one_positive_killable() NeilBrown
2025-09-11 20:05   ` Al Viro [this message]
2025-09-11 23:02     ` NeilBrown
2025-09-09  4:43 ` [PATCH v2 2/7] VFS: discard err2 in filename_create() NeilBrown
2025-09-09 11:24   ` Jeff Layton
2025-09-09  4:43 ` [PATCH v2 3/7] VFS: unify old_mnt_idmap and new_mnt_idmap in renamedata NeilBrown
2025-09-09  4:43 ` [PATCH v2 4/7] VFS/audit: introduce kern_path_parent() for audit NeilBrown
2025-09-09  4:43 ` [PATCH v2 5/7] VFS: rename kern_path_locked() and related functions NeilBrown
2025-09-09 14:07   ` Amir Goldstein
2025-09-10  2:49     ` NeilBrown
2025-09-09  4:43 ` [PATCH v2 6/7] VFS: introduce simple_end_creating() and simple_failed_creating() NeilBrown
2025-09-09  8:20   ` Al Viro
2025-09-09  4:43 ` [PATCH v2 7/7] Use simple_start_creating() in various places NeilBrown
2025-09-09  8:19   ` Al Viro
2025-09-10  3:01     ` NeilBrown
2025-09-10  4:12       ` Al Viro
2025-09-10  4:16         ` Al Viro
2025-09-10  7:37           ` Al Viro
2025-09-10 11:04             ` Jeff Layton
2025-09-10 11:30               ` NeilBrown
2025-09-10 11:54                 ` Jeff Layton
2025-09-10 18:28                   ` Al Viro
2025-09-10 12:34             ` Jeff Layton
2025-09-10 23:13           ` NeilBrown

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=20250911200559.GW39973@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=neil@brown.name \
    /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;
as well as URLs for NNTP newsgroup(s).