From: Al Viro <viro@zeniv.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Linus Walleij <linus.walleij@linaro.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [GIT PULL] gpio: updates for v5.13
Date: Tue, 4 May 2021 01:55:42 +0000 [thread overview]
Message-ID: <YJCpnvKUNx+Tc+vg@zeniv-ca.linux.org.uk> (raw)
In-Reply-To: <YJBA1iYK7npit9vn@zeniv-ca.linux.org.uk>
On Mon, May 03, 2021 at 06:28:38PM +0000, Al Viro wrote:
> > So Al, do you see anything horrendous in how that configfs thing uses
> > a rename to do kind of an "atomic swap" of configfs state?
>
> Give me a few hours; configfs is playing silly buggers with a lot of
> structures when creating/tearing down subtrees, and I'd actually
> expect more trouble with configfs data structures than with VFS ones.
>
> I'll take a look.
FWIW, one obviously bogus thing is this:
+ spin_lock(&configfs_dirent_lock);
+ new_dentry->d_fsdata = sd;
+ list_move(&sd->s_sibling, &new_parent_sd->s_children);
+ item->ci_parent = new_parent_item;
+ d_move(old_dentry, new_dentry);
+ spin_unlock(&configfs_dirent_lock);
on successful ->rename(). sd here comes from
+ sd = old_dentry->d_fsdata;
Now, take a look at configfs_d_iput(). ->d_fsdata contributes
to refcount of sd, and I don't see anything here that would grab the
reference.
Incidentally, if your code critically depends upon some field
being first in such-and-such structure, you should either get rid of
the dependency or at least bother to document that.
That
+ /*
+ * Free memory allocated for the pending and live directories
+ * of committable groups.
+ */
+ if (sd->s_type & (CONFIGFS_GROUP_PENDING | CONFIGFS_GROUP_LIVE))
+ kfree(sd->s_element);
+
is asking for trouble down the road.
I dislike (for the lack of adequate printable terms) the way configfs
deals with subtree creation and, especially, removal. It's kept attached
to dentry tree (all the way to the root) as we build it and, in case we
fail halfway through, as we are trying to take it apart.
There is convoluted code trying to prevent breakage in such cases,
but it's complex, brittle and I don't remember how critical the lack of
renames had been in its analysis. I can try to redo that, but that would
take some time - IIRC, the last time I did it, it took several days
of work (including arseloads of grepping through configfs users and
doing RTFS in those)
IMO we should attach the subtree we'd built only when it's
fully set up. I can dig out the notes (from 2 years ago) on how to massage
the damn thing in that direction, but again, it'll take a day or two
to verify that analysis still applies. OTOH, that would simplify the code
considerably, so the next time we want to change something it wouldn't
be so unpleasant.
next prev parent reply other threads:[~2021-05-04 1:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-02 19:32 [GIT PULL] gpio: updates for v5.13 Bartosz Golaszewski
2021-05-03 18:03 ` Linus Torvalds
2021-05-03 18:28 ` Al Viro
2021-05-03 18:29 ` Linus Torvalds
2021-05-04 1:55 ` Al Viro [this message]
2021-05-04 14:17 ` Bartosz Golaszewski
2021-05-04 17:34 ` Al Viro
2021-05-04 17:41 ` Andy Shevchenko
2021-05-05 14:19 ` Bartosz Golaszewski
2021-05-12 19:11 ` configfs: commitable items (was Re: [GIT PULL] gpio: updates for v5.13) Bartosz Golaszewski
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=YJCpnvKUNx+Tc+vg@zeniv-ca.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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