From: Jeffle Xu <jefflexu@linux.alibaba.com>
To: gregkh@linuxfoundation.org, sashal@kernel.org
Cc: stable@vger.kernel.org, joseph.qi@linux.alibaba.com,
caspar@linux.alibaba.com, Jeffle Xu <jefflexu@linux.alibaba.com>,
Hannes Reinecke <hare@suse.de>
Subject: [PATCH 2/3] aoe: close udev startup race condition as default groups
Date: Sun, 7 Feb 2021 19:46:55 +0800 [thread overview]
Message-ID: <20210207114656.32141-3-jefflexu@linux.alibaba.com> (raw)
In-Reply-To: <20210207114656.32141-1-jefflexu@linux.alibaba.com>
commit fef912bf860e8e7e48a2bfb978a356bba743a8b7 upstream.
commit 95cf7809bf9169fec4e4b7bb24b8069d8f354f96 upstream.
Similar to commit 9e07f4e24379 ("zram: close udev startup race condition
as default groups"), this is a merge of [1, 2], since [1] may be too
large size to be merged into -stable tree.
[1] fef912bf860e, block: genhd: add 'groups' argument to device_add_disk
[2] 95cf7809bf91, aoe: register default groups with device_add_disk()
Cc: Hannes Reinecke <hare@suse.de>
Cc: stable@vger.kernel.org # 4.4+
Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com>
---
drivers/block/aoe/aoe.h | 1 -
drivers/block/aoe/aoeblk.c | 20 +++++++-------------
drivers/block/aoe/aoedev.c | 1 -
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
index c0ebda1283cc..015c68017a1c 100644
--- a/drivers/block/aoe/aoe.h
+++ b/drivers/block/aoe/aoe.h
@@ -201,7 +201,6 @@ int aoeblk_init(void);
void aoeblk_exit(void);
void aoeblk_gdalloc(void *);
void aoedisk_rm_debugfs(struct aoedev *d);
-void aoedisk_rm_sysfs(struct aoedev *d);
int aoechr_init(void);
void aoechr_exit(void);
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index 429ebb84b592..769f3a10054e 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -177,10 +177,15 @@ static struct attribute *aoe_attrs[] = {
NULL,
};
-static const struct attribute_group attr_group = {
+static const struct attribute_group aoe_attr_group = {
.attrs = aoe_attrs,
};
+static const struct attribute_group *aoe_attr_groups[] = {
+ &aoe_attr_group,
+ NULL,
+};
+
static const struct file_operations aoe_debugfs_fops = {
.open = aoe_debugfs_open,
.read = seq_read,
@@ -219,17 +224,6 @@ aoedisk_rm_debugfs(struct aoedev *d)
d->debugfs = NULL;
}
-static int
-aoedisk_add_sysfs(struct aoedev *d)
-{
- return sysfs_create_group(&disk_to_dev(d->gd)->kobj, &attr_group);
-}
-void
-aoedisk_rm_sysfs(struct aoedev *d)
-{
- sysfs_remove_group(&disk_to_dev(d->gd)->kobj, &attr_group);
-}
-
static int
aoeblk_open(struct block_device *bdev, fmode_t mode)
{
@@ -417,8 +411,8 @@ aoeblk_gdalloc(void *vp)
spin_unlock_irqrestore(&d->lock, flags);
+ disk_to_dev(gd)->groups = aoe_attr_groups;
add_disk(gd);
- aoedisk_add_sysfs(d);
aoedisk_add_debugfs(d);
spin_lock_irqsave(&d->lock, flags);
diff --git a/drivers/block/aoe/aoedev.c b/drivers/block/aoe/aoedev.c
index 41060e9cedf2..f29a140cdbc1 100644
--- a/drivers/block/aoe/aoedev.c
+++ b/drivers/block/aoe/aoedev.c
@@ -275,7 +275,6 @@ freedev(struct aoedev *d)
del_timer_sync(&d->timer);
if (d->gd) {
aoedisk_rm_debugfs(d);
- aoedisk_rm_sysfs(d);
del_gendisk(d->gd);
put_disk(d->gd);
blk_cleanup_queue(d->blkq);
--
2.27.0
next prev parent reply other threads:[~2021-02-07 11:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-07 11:46 [PATCH 0/3] close udev startup race condition for several devices Jeffle Xu
2021-02-07 11:46 ` [PATCH 1/3] virtio-blk: close udev startup race condition as default groups Jeffle Xu
2021-02-07 11:56 ` Greg KH
2021-02-07 22:46 ` Sasha Levin
2021-02-08 1:40 ` JeffleXu
2021-02-17 13:12 ` JeffleXu
2021-02-17 13:26 ` Greg KH
2021-02-18 2:23 ` JeffleXu
2021-02-07 11:46 ` Jeffle Xu [this message]
2021-02-07 11:46 ` [PATCH 3/3] nvme: " Jeffle Xu
2021-02-07 11:52 ` [PATCH 0/3] close udev startup race condition for several devices JeffleXu
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=20210207114656.32141-3-jefflexu@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=caspar@linux.alibaba.com \
--cc=gregkh@linuxfoundation.org \
--cc=hare@suse.de \
--cc=joseph.qi@linux.alibaba.com \
--cc=sashal@kernel.org \
--cc=stable@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