From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, David Sterba <dsterba@suse.com>,
Christoph Hellwig <hch@lst.de>, Joel Becker <jlbec@evilplan.org>,
John Johansen <john.johansen@canonical.com>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna.schumaker@netapp.com>,
Steven Rostedt <rostedt@goodmis.org>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v3 06/10] debugfs: simplify __debugfs_remove_file()
Date: Mon, 3 Jun 2019 15:31:22 +0200 [thread overview]
Message-ID: <20190603133122.GA24574@kroah.com> (raw)
In-Reply-To: <20190526143411.11244-7-amir73il@gmail.com>
On Sun, May 26, 2019 at 05:34:07PM +0300, Amir Goldstein wrote:
> Move simple_unlink()+d_delete() from __debugfs_remove_file() into
> caller __debugfs_remove() and rename helper for post remove file to
> __debugfs_file_removed().
>
> This will simplify adding fsnotify_unlink() hook.
>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
> fs/debugfs/inode.c | 20 ++++++++------------
> 1 file changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
> index acef14ad53db..d89874da9791 100644
> --- a/fs/debugfs/inode.c
> +++ b/fs/debugfs/inode.c
> @@ -617,13 +617,10 @@ struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent,
> }
> EXPORT_SYMBOL_GPL(debugfs_create_symlink);
>
> -static void __debugfs_remove_file(struct dentry *dentry, struct dentry *parent)
> +static void __debugfs_file_removed(struct dentry *dentry)
> {
> struct debugfs_fsdata *fsd;
>
> - simple_unlink(d_inode(parent), dentry);
> - d_delete(dentry);
> -
> /*
> * Paired with the closing smp_mb() implied by a successful
> * cmpxchg() in debugfs_file_get(): either
> @@ -644,16 +641,15 @@ static int __debugfs_remove(struct dentry *dentry, struct dentry *parent)
>
> if (simple_positive(dentry)) {
> dget(dentry);
> - if (!d_is_reg(dentry)) {
> - if (d_is_dir(dentry))
> - ret = simple_rmdir(d_inode(parent), dentry);
> - else
> - simple_unlink(d_inode(parent), dentry);
> - if (!ret)
> - d_delete(dentry);
> + if (d_is_dir(dentry)) {
> + ret = simple_rmdir(d_inode(parent), dentry);
> } else {
> - __debugfs_remove_file(dentry, parent);
> + simple_unlink(d_inode(parent), dentry);
> }
> + if (!ret)
> + d_delete(dentry);
> + if (d_is_reg(dentry))
> + __debugfs_file_removed(dentry);
> dput(dentry);
> }
> return ret;
Ugh, I had to stare at this for a long time. I _think_ it all looks
equalivant now, but if this breaks, I know who to blame :)
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
next prev parent reply other threads:[~2019-06-03 13:31 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-26 14:34 [PATCH v3 00/10] Sort out fsnotify_nameremove() mess Amir Goldstein
2019-05-26 14:34 ` [PATCH v3 01/10] fsnotify: add empty fsnotify_{unlink,rmdir}() hooks Amir Goldstein
2019-05-26 14:34 ` [PATCH v3 02/10] btrfs: call fsnotify_rmdir() hook Amir Goldstein
2019-05-26 14:34 ` [PATCH v3 03/10] rpc_pipefs: call fsnotify_{unlink,rmdir}() hooks Amir Goldstein
2019-05-27 10:53 ` Jan Kara
2019-05-27 13:26 ` Amir Goldstein
2019-05-27 14:00 ` Jan Kara
2019-05-30 5:43 ` Amir Goldstein
2019-05-30 12:16 ` Trond Myklebust
2019-05-26 14:34 ` [PATCH v3 04/10] tracefs: " Amir Goldstein
2019-06-13 16:53 ` Amir Goldstein
2019-08-30 19:48 ` Steven Rostedt
2019-09-02 8:46 ` Jan Kara
2019-05-26 14:34 ` [PATCH v3 05/10] devpts: call fsnotify_unlink() hook Amir Goldstein
2019-05-26 14:34 ` [PATCH v3 06/10] debugfs: simplify __debugfs_remove_file() Amir Goldstein
2019-05-30 5:49 ` Amir Goldstein
2019-05-30 12:27 ` Greg KH
2019-06-03 13:31 ` Greg Kroah-Hartman [this message]
2019-05-26 14:34 ` [PATCH v3 07/10] debugfs: call fsnotify_{unlink,rmdir}() hooks Amir Goldstein
2019-06-03 13:31 ` Greg Kroah-Hartman
2019-05-26 14:34 ` [PATCH v3 08/10] configfs: call fsnotify_rmdir() hook Amir Goldstein
2019-05-30 6:06 ` Amir Goldstein
2019-06-13 16:57 ` Amir Goldstein
2019-05-26 14:34 ` [PATCH v3 09/10] fsnotify: move fsnotify_nameremove() hook out of d_delete() Amir Goldstein
2019-05-26 14:34 ` [PATCH v3 10/10] fsnotify: get rid of fsnotify_nameremove() Amir Goldstein
2019-05-27 8:24 ` [PATCH v3 00/10] Sort out fsnotify_nameremove() mess Greg Kroah-Hartman
2019-05-27 9:49 ` Amir Goldstein
2019-05-27 11:41 ` Greg Kroah-Hartman
2019-05-27 11:59 ` Jan Kara
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=20190603133122.GA24574@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=amir73il@gmail.com \
--cc=anna.schumaker@netapp.com \
--cc=dsterba@suse.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=jlbec@evilplan.org \
--cc=john.johansen@canonical.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=trond.myklebust@hammerspace.com \
--cc=viro@zeniv.linux.org.uk \
/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).