From: Artem Bityutskiy <dedekind1@gmail.com>
To: Iosif Harutyunov <iharutyunov@SonicWALL.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: Re: [PATCH] mtd: ubi: Fix race condition between ubi device creation and udev
Date: Fri, 22 Jul 2016 11:45:41 +0300 [thread overview]
Message-ID: <1469177141.2405.137.camel@gmail.com> (raw)
In-Reply-To: <1AA17CE09ACFBD499BB5F503A7513F5B43ADFB03@us0exc08.us.sonicwall.com>
On Thu, 2016-07-21 at 02:07 +0000, Iosif Harutyunov wrote:
> While implementing udev rules for UBI device I ran into the problem
> when udev would
> ignore UBI rules I created to process attachment of volume.
> Interestingly, when I trigger
> udev ubi subsystem "change" event manually after the attachment,
> rules would work just fine.
>
> I traced problem down to UBI sysfs processing, which turned out to be
> racing condition.
> See patch below to address the problem.
>
> Thanks.
> Iosif,_
>
> Signed-off-by: Iosif Harutyunov <iharutyunov@sonicwall.com>
> ---
> Once ubi is attached, make sure ubi_devices[] is initialized early
> before being
> used in the dev_attribute_show().
>
> This is to prevent race condition between udev ubi rules processing
> and ubi device
> creation, which manifests itself ignoring udev ATTR rules.
Good catch!
Quick feedback: this patch will probably work fine, we could apply the
following logic and select a better place for that line of code. Here
it is:
1. Initialize the device, make it usable. Do not make it available to
anyone before that. This is the code before the 'uif_init()'
invocation. BTW, "uif" means "user interfaces" in this case.
2. Make the device "available" (or "visible") by adding it to the
'ubi_devices' array.
3. Initialize user interfaces, done by 'uif_init()'.
IOW, it put that line just before 'uif_init()'.
next prev parent reply other threads:[~2016-07-22 8:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-21 2:07 [PATCH] mtd: ubi: Fix race condition between ubi device creation and udev Iosif Harutyunov
2016-07-21 11:42 ` Richard Weinberger
2016-07-22 0:32 ` Iosif Harutyunov
2016-07-22 8:45 ` Artem Bityutskiy [this message]
2016-07-22 23:22 ` Harutyunov, Iosif
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=1469177141.2405.137.camel@gmail.com \
--to=dedekind1@gmail.com \
--cc=iharutyunov@SonicWALL.com \
--cc=linux-mtd@lists.infradead.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