linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Christian Brauner <brauner@kernel.org>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] dcache: rename d_genocide()
Date: Tue, 13 Feb 2024 04:42:14 +0000	[thread overview]
Message-ID: <20240213044214.GA1768094@ZenIV> (raw)
In-Reply-To: <20240212080926.GJ608142@ZenIV>

On Mon, Feb 12, 2024 at 08:09:26AM +0000, Al Viro wrote:

> Bloody bad idea, IMO.  Note that straight use of kill_anon_super()
> pretty much forces you into doing everything from ->put_super().
> And that leads to rather clumsy failure exits in foo_fill_super(),
> since you *won't* get ->put_super() called unless you've got to
> setting ->s_root.
> 
> Considering how easily the failure exits rot, I'd rather discourage
> that variant.

BTW, take a look at fs/ext2/super.c and compare the mess in failure
exits in ext2_fill_super() with ext2_put_super().  See the amount of
duplication?

In case of ext2_fill_super() success eventual ->kill_sb() will call
->put_super() (from generic_shutdown_super(), from kill_block_super()).

What happens in case of ext2_fill_super() failure?  ->kill_sb() is called,
but ->put_super() is only called if ->s_root is non-NULL (and at the very
least it requires ->s_op to have been set).  So in that case we have
ext2_fill_super() manually undo the allocations, etc. it had managed to do,
same as ext2_put_super() would've done.

If that stuff gets lifted into ->kill_sb(), we get the bulk of ext2_put_super()
moved into ext2_kill_super() (I wouldn't be surprised if ext2_put_super()
completely disappeared, actually), with all those goto failed_mount<something>
in ext2_fill_super() turning into plain return -E...

  reply	other threads:[~2024-02-13  4:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-10 10:06 [PATCH] dcache: rename d_genocide() Amir Goldstein
2024-02-10 23:27 ` Al Viro
2024-02-11  8:00   ` Amir Goldstein
2024-02-11 18:44     ` Al Viro
2024-02-12  7:02       ` Amir Goldstein
2024-02-12  8:09         ` Al Viro
2024-02-13  4:42           ` Al Viro [this message]
2024-02-13  6:42             ` Amir Goldstein

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=20240213044214.GA1768094@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /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).