From: Christian Brauner <brauner@kernel.org>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/4] spufs: fix gang directory lifetimes
Date: Thu, 13 Mar 2025 09:28:12 +0100 [thread overview]
Message-ID: <20250313-lakai-halbjahr-d302c0e6108b@brauner> (raw)
In-Reply-To: <20250313042901.GB2123707@ZenIV>
On Thu, Mar 13, 2025 at 04:29:01AM +0000, Al Viro wrote:
> prior to "[POWERPC] spufs: Fix gang destroy leaks" we used to have
> a problem with gang lifetimes - creation of a gang returns opened
> gang directory, which normally gets removed when that gets closed,
> but if somebody has created a context belonging to that gang and
> kept it alive until the gang got closed, removal failed and we
> ended up with a leak.
>
> Unfortunately, it had been fixed the wrong way. Dentry of gang
> directory was no longer pinned, and rmdir on close was gone.
> One problem was that failure of open kept calling simple_rmdir()
> as cleanup, which meant an unbalanced dput(). Another bug was
> in the success case - gang creation incremented link count on
> root directory, but that was no longer undone when gang got
> destroyed.
>
> Fix consists of
> * reverting the commit in question
> * adding a counter to gang, protected by ->i_rwsem
> of gang directory inode.
> * having it set to 1 at creation time, dropped
> in both spufs_dir_close() and spufs_gang_close() and bumped
> in spufs_create_context(), provided that it's not 0.
> * using simple_recursive_removal() to take the gang
> directory out when counter reaches zero.
>
> Fixes: 877907d37da9 "[POWERPC] spufs: Fix gang destroy leaks"
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
Reviewed-by: Christian Brauner <brauner@kernel.org>
next prev parent reply other threads:[~2025-03-13 8:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 4:27 [PATCHES] several fixes from tree-in-dcache stuff Al Viro
2025-03-13 4:28 ` [PATCH 1/4] spufs: fix a leak on spufs_new_file() failure Al Viro
2025-03-13 8:26 ` Christian Brauner
2025-03-13 4:29 ` [PATCH 2/4] spufs: fix gang directory lifetimes Al Viro
2025-03-13 8:28 ` Christian Brauner [this message]
2025-03-13 4:29 ` [PATCH 3/4] spufs: fix a leak in spufs_create_context() Al Viro
2025-03-13 8:28 ` Christian Brauner
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=20250313-lakai-halbjahr-d302c0e6108b@brauner \
--to=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--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