From: Al Viro <viro@zeniv.linux.org.uk>
To: NeilBrown <neil@brown.name>
Cc: Christian Brauner <brauner@kernel.org>,
Amir Goldstein <amir73il@gmail.com>, Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org, Jeff Layton <jlayton@kernel.org>,
Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.com>,
David Howells <dhowells@redhat.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Tyler Hicks <code@tyhicks.com>,
Miklos Szeredi <miklos@szeredi.hu>,
Chuck Lever <chuck.lever@oracle.com>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Namjae Jeon <linkinjeon@kernel.org>,
Steve French <smfrench@gmail.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Carlos Maiolino <cem@kernel.org>,
John Johansen <john.johansen@canonical.com>,
Paul Moore <paul@paul-moore.com>,
James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
Stephen Smalley <stephen.smalley.work@gmail.com>,
Ondrej Mosnacek <omosnace@redhat.com>,
Mateusz Guzik <mjguzik@gmail.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Stefan Berger <stefanb@linux.ibm.com>,
"Darrick J. Wong" <djwong@kernel.org>,
linux-kernel@vger.kernel.org, netfs@lists.linux.dev,
ecryptfs@vger.kernel.org, linux-nfs@vger.kernel.org,
linux-unionfs@vger.kernel.org, linux-cifs@vger.kernel.org,
linux-xfs@vger.kernel.org, apparmor@lists.ubuntu.com,
linux-security-module@vger.kernel.org, selinux@vger.kernel.org
Subject: Re: [PATCH v4 11/14] Add start_renaming_two_dentries()
Date: Thu, 30 Oct 2025 06:22:14 +0000 [thread overview]
Message-ID: <20251030062214.GW2441659@ZenIV> (raw)
In-Reply-To: <20251029234353.1321957-12-neilb@ownmail.net>
On Thu, Oct 30, 2025 at 10:31:11AM +1100, NeilBrown wrote:
> +++ b/fs/debugfs/inode.c
Why does debugfs_change_name() need any of that horror? Seriously, WTF?
This is strictly a name change on a filesystem that never, ever moves
anything from one directory to another.
IMO struct renamedata is a fucking eyesore, but that aside, this:
> @@ -539,22 +540,30 @@ static int sel_make_policy_nodes(struct selinux_fs_info *fsi,
> if (ret)
> goto out;
>
> - lock_rename(tmp_parent, fsi->sb->s_root);
> + rd.old_parent = tmp_parent;
> + rd.new_parent = fsi->sb->s_root;
>
> /* booleans */
> - d_exchange(tmp_bool_dir, fsi->bool_dir);
> + ret = start_renaming_two_dentries(&rd, tmp_bool_dir, fsi->bool_dir);
> + if (!ret) {
> + d_exchange(tmp_bool_dir, fsi->bool_dir);
>
> - swap(fsi->bool_num, bool_num);
> - swap(fsi->bool_pending_names, bool_names);
> - swap(fsi->bool_pending_values, bool_values);
> + swap(fsi->bool_num, bool_num);
> + swap(fsi->bool_pending_names, bool_names);
> + swap(fsi->bool_pending_values, bool_values);
>
> - fsi->bool_dir = tmp_bool_dir;
> + fsi->bool_dir = tmp_bool_dir;
> + end_renaming(&rd);
> + }
>
> /* classes */
> - d_exchange(tmp_class_dir, fsi->class_dir);
> - fsi->class_dir = tmp_class_dir;
> + ret = start_renaming_two_dentries(&rd, tmp_class_dir, fsi->class_dir);
> + if (ret == 0) {
> + d_exchange(tmp_class_dir, fsi->class_dir);
> + fsi->class_dir = tmp_class_dir;
>
> - unlock_rename(tmp_parent, fsi->sb->s_root);
> + end_renaming(&rd);
> + }
>
> out:
> sel_remove_old_bool_data(bool_num, bool_names, bool_values);
is very interesting - suddenly you get two non-overlapping scopes instead of one.
Why is that OK?
next prev parent reply other threads:[~2025-10-30 6:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 23:31 [PATCH v4 00/14] Create and use APIs to centralise locking for directory ops NeilBrown
2025-10-29 23:31 ` [PATCH v4 01/14] debugfs: rename end_creating() to debugfs_end_creating() NeilBrown
2025-10-30 5:32 ` Greg Kroah-Hartman
2025-10-29 23:31 ` [PATCH v4 02/14] VFS: introduce start_dirop() and end_dirop() NeilBrown
2025-10-29 23:31 ` [PATCH v4 03/14] VFS: tidy up do_unlinkat() NeilBrown
2025-10-29 23:31 ` [PATCH v4 04/14] VFS/nfsd/cachefiles/ovl: add start_creating() and end_creating() NeilBrown
2025-10-29 23:31 ` [PATCH v4 05/14] VFS/nfsd/cachefiles/ovl: introduce start_removing() and end_removing() NeilBrown
2025-10-29 23:31 ` [PATCH v4 06/14] VFS: introduce start_creating_noperm() and start_removing_noperm() NeilBrown
2025-10-29 23:31 ` [PATCH v4 07/14] VFS: introduce start_removing_dentry() NeilBrown
2025-10-30 6:11 ` Al Viro
2025-10-30 23:22 ` NeilBrown
2025-10-29 23:31 ` [PATCH v4 08/14] VFS: add start_creating_killable() and start_removing_killable() NeilBrown
2025-10-29 23:31 ` [PATCH v4 09/14] VFS/nfsd/ovl: introduce start_renaming() and end_renaming() NeilBrown
2025-10-30 13:22 ` Chuck Lever
2025-10-29 23:31 ` [PATCH v4 10/14] VFS/ovl/smb: introduce start_renaming_dentry() NeilBrown
2025-10-30 0:02 ` Namjae Jeon
2025-10-29 23:31 ` [PATCH v4 11/14] Add start_renaming_two_dentries() NeilBrown
2025-10-30 6:22 ` Al Viro [this message]
2025-10-30 23:37 ` NeilBrown
2025-10-29 23:31 ` [PATCH v4 12/14] ecryptfs: use new start_creating/start_removing APIs NeilBrown
2025-10-30 6:24 ` Al Viro
2025-10-30 23:41 ` NeilBrown
2025-10-29 23:31 ` [PATCH v4 13/14] VFS: change vfs_mkdir() to unlock on failure NeilBrown
2025-10-29 23:31 ` [PATCH v4 14/14] VFS: introduce end_creating_keep() 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=20251030062214.GW2441659@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=Dai.Ngo@oracle.com \
--cc=amir73il@gmail.com \
--cc=apparmor@lists.ubuntu.com \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=clm@fb.com \
--cc=code@tyhicks.com \
--cc=dakr@kernel.org \
--cc=dhowells@redhat.com \
--cc=djwong@kernel.org \
--cc=dsterba@suse.com \
--cc=ecryptfs@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=jmorris@namei.org \
--cc=john.johansen@canonical.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=miklos@szeredi.hu \
--cc=mjguzik@gmail.com \
--cc=neil@brown.name \
--cc=netfs@lists.linux.dev \
--cc=okorniev@redhat.com \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=rafael@kernel.org \
--cc=selinux@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=serge@hallyn.com \
--cc=smfrench@gmail.com \
--cc=stefanb@linux.ibm.com \
--cc=stephen.smalley.work@gmail.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;
as well as URLs for NNTP newsgroup(s).