From: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: neilb-l3A5Bk7waGM@public.gmane.org,
koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org
Cc: linux-raid-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [RFC PATCH 4/7] bcache: fix symlink removal
Date: Fri, 11 May 2012 12:46:31 -0700 [thread overview]
Message-ID: <20120511194631.25770.87184.stgit@dwillia2-linux.jf.intel.com> (raw)
In-Reply-To: <20120511194327.25770.79292.stgit-p8uTFz9XbKgaePuBGzJMJzMJUdESFZ8XQQ4Iyu8u01E@public.gmane.org>
symlinks need to be removed prior to the kobject being deleted,
otherwise we get:
WARNING: at fs/sysfs/inode.c:323 sysfs_hash_and_remove+0xa9/0xb0()
Hardware name: Bochs
sysfs: can not remove 'cache', no directory
Signed-off-by: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
drivers/block/bcache/super.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/block/bcache/super.c b/drivers/block/bcache/super.c
index 70d7bcd..3289db9 100644
--- a/drivers/block/bcache/super.c
+++ b/drivers/block/bcache/super.c
@@ -747,9 +747,6 @@ static void bcache_device_detach(struct bcache_device *d)
atomic_set(&d->detaching, 0);
}
- sysfs_remove_link(&d->c->kobj, d->name);
- sysfs_remove_link(&d->kobj, "cache");
-
d->c->devices[d->id] = NULL;
closure_put(&d->c->caching);
d->c = NULL;
@@ -1049,10 +1046,13 @@ static void cached_dev_free(struct closure *cl)
static void cached_dev_flush(struct closure *cl)
{
- struct cached_dev *d = container_of(cl, struct cached_dev, disk.cl);
+ struct cached_dev *cd = container_of(cl, struct cached_dev, disk.cl);
+ struct bcache_device *d = &cd->disk;
- destroy_cache_accounting(&d->accounting);
- kobject_del(&d->disk.kobj);
+ destroy_cache_accounting(&cd->accounting);
+ sysfs_remove_link(&d->kobj, d->name);
+ sysfs_remove_link(&d->kobj, "cache");
+ kobject_del(&d->kobj);
continue_at(cl, cached_dev_free, system_wq);
}
@@ -1175,6 +1175,9 @@ static void flash_dev_free(struct closure *cl)
static void flash_dev_flush(struct closure *cl)
{
struct bcache_device *d = container_of(cl, struct bcache_device, cl);
+
+ sysfs_remove_link(&d->c->kobj, d->name);
+ sysfs_remove_link(&d->kobj, "cache");
kobject_del(&d->kobj);
continue_at(cl, flash_dev_free, system_wq);
}
next prev parent reply other threads:[~2012-05-11 19:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-11 19:46 [RFC PATCH 0/7] bcache: md conversion Dan Williams
[not found] ` <20120511194327.25770.79292.stgit-p8uTFz9XbKgaePuBGzJMJzMJUdESFZ8XQQ4Iyu8u01E@public.gmane.org>
2012-05-11 19:46 ` [RFC PATCH 1/7] bcache: compile fix Dan Williams
2012-05-11 19:46 ` [RFC PATCH 2/7] bcache: disable lockdep, enable CONFIG_BCACHE=m Dan Williams
2012-05-11 19:46 ` [RFC PATCH 3/7] bcache: drop select COMPACTION Dan Williams
2012-05-11 19:46 ` Dan Williams [this message]
2012-05-11 19:46 ` [RFC PATCH 5/7] bcache: move to drivers/md/ Dan Williams
2012-05-11 19:46 ` [RFC PATCH 6/7] bcache: uplevel allocation of 'cached_dev' and 'cache' Dan Williams
2012-05-11 19:46 ` [RFC PATCH 7/7] md: add bcache personality Dan Williams
2012-05-18 16:52 ` Doug Ledford
2012-05-18 16:57 ` Dan Williams
2012-05-11 19:52 ` [RFC PATCH 0/7] bcache: md conversion Joseph Glanville
2012-05-14 23:15 ` Kent Overstreet
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=20120511194631.25770.87184.stgit@dwillia2-linux.jf.intel.com \
--to=dan.j.williams-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-raid-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=neilb-l3A5Bk7waGM@public.gmane.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;
as well as URLs for NNTP newsgroup(s).