linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Li Zetao <lizetao1@huawei.com>
Cc: adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org
Subject: Re: [PATCH -next 0/3] ext4: Using scope-based resource management function
Date: Wed, 6 Nov 2024 23:16:44 -0500	[thread overview]
Message-ID: <20241107041644.GE172001@mit.edu> (raw)
In-Reply-To: <20240823061824.3323522-1-lizetao1@huawei.com>

On Fri, Aug 23, 2024 at 02:18:21PM +0800, Li Zetao wrote:
> Hi all,
> 
> This patch set is dedicated to using scope-based resource management
> functions to replace the direct use of lock/unlock methods, so that
> developers can focus more on using resources in a certain scope and
> avoid overly focusing on resource leakage issues.
> 
> At the same time, some functions can remove the controversial goto
> label(eg: patch 3), which usually only releases resources and then
> exits the function. After replacement, these functions can exit
> directly without worrying about resources not being released.
> 
> This patch set has been tested by fsstress for a long time and no
> problems were found.

Hmm, I'm torn.  I do like the simplification that these patches can
offer.

The potential downsides/problems that are worrying me:

1) The zero day test bot has flagged a number of warnings[1]

[1] https://lore.kernel.org/r/202408290407.XQuWf1oH-lkp@intel.com

2) The documentation for guard() and scoped_guard() is pretty sparse,
    and the comments in include/linux/cleanup.h are positively
    confusing.  There is a real need for a tutorial which explains how
    they should be used in the Documentation directory, or maybe a
    LWN.net article.  Still, after staring that the implementation, I
    was able to figure it out, but I'm bit worried that people who
    aren't familiar with this construt which appears to have laned in
    August 2023, might find the code less readable.

3)  Once this this lands, I could see potential problems when bug fixes
    are backported to stable kernels older than 6.6, since this changes
    how lock and unlock calls in the ext4 code.  So unless
    include/linux/cleanup.h is backported to all of the LTS kernels, as
    well as these ext4 patches, there is a ris that a future (possibly
    security) bug fix will result in a missing unlock leading to
    hilarity and/or sadness.

    I'm reminded of the story of XFS changing the error return
    semantics from errno to -errno, and resulting bugs when patches
    were automatically backported to the stable kernels leading to
    real problems, which is why XFS opted out of LTS backports.  This
    patch series could have the same problem.... and I haven't been
    able to recruit someone to be the ext4 stable kernel maintainers
    who could monitor xfstests resullts with lockdep enabled to catch
    potential problems.

That being said, I do see the value of the change

What do other ext4 developers think?

						- Ted

  parent reply	other threads:[~2024-11-07  4:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23  6:18 [PATCH -next 0/3] ext4: Using scope-based resource management function Li Zetao
2024-08-23  6:18 ` [PATCH -next 1/3] ext4: Use scoped()/scoped_guard() to drop read_lock()/unlock pair Li Zetao
2024-08-23  6:18 ` [PATCH -next 2/3] ext4: Use scoped()/scoped_guard() to drop write_lock()/unlock pair Li Zetao
2024-08-23  6:18 ` [PATCH -next 3/3] ext4: Use scoped()/scoped_guard() to drop rcu_read_lock()/unlock pair Li Zetao
2024-08-28 21:34   ` kernel test robot
2024-11-07  4:16 ` Theodore Ts'o [this message]
2024-11-07 21:00   ` [PATCH -next 0/3] ext4: Using scope-based resource management function Andreas Dilger
2024-11-08 11:06   ` 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=20241107041644.GE172001@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=lizetao1@huawei.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).