summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlava Pestov <sviatoslavpestov@gmail.com>2015-01-31 18:28:21 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-18 20:26:55 -0900
commit342323740517cf2c318a78a06a53ee9164b8a847 (patch)
tree91b7997627f433cccb498a4397227fc743a217f0
parent4700edfabdb241ca29f34573ca479607693d7e12 (diff)
bcache: add remove_failed notification
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--drivers/md/bcache/notify.c9
-rw-r--r--drivers/md/bcache/notify.h1
-rw-r--r--drivers/md/bcache/super.c2
3 files changed, 12 insertions, 0 deletions
diff --git a/drivers/md/bcache/notify.c b/drivers/md/bcache/notify.c
index 99a70f28d4e5..ee194a59b547 100644
--- a/drivers/md/bcache/notify.c
+++ b/drivers/md/bcache/notify.c
@@ -104,6 +104,15 @@ void bch_notify_cache_removing(struct cache *ca)
notify_put(c);
}
+void bch_notify_cache_remove_failed(struct cache *ca)
+{
+ struct cache_set *c = ca->set;
+
+ notify_get_cache(ca);
+ notify_var(c, "STATE=remove_failed");
+ notify_put(c);
+}
+
void bch_notify_cache_removed(struct cache *ca)
{
struct cache_set *c = ca->set;
diff --git a/drivers/md/bcache/notify.h b/drivers/md/bcache/notify.h
index e121a711cf1d..80d658768764 100644
--- a/drivers/md/bcache/notify.h
+++ b/drivers/md/bcache/notify.h
@@ -16,6 +16,7 @@ void bch_notify_cache_read_only(struct cache *);
void bch_notify_cache_added(struct cache *);
void bch_notify_cache_removing(struct cache *);
void bch_notify_cache_removed(struct cache *);
+void bch_notify_cache_remove_failed(struct cache *);
void bch_notify_cache_error(struct cache *, bool);
#endif /* _NOTIFY_H */
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 3630088946fb..6ab2561c4472 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1563,6 +1563,7 @@ static void bch_cache_remove_work(struct work_struct *work)
clear_bit(CACHE_DEV_REMOVING, &ca->flags);
pr_err("Can't remove last device in tier %u of %pU.",
tier, c->sb.set_uuid.b);
+ bch_notify_cache_remove_failed(ca);
return;
}
@@ -1661,6 +1662,7 @@ static void bch_cache_remove_work(struct work_struct *work)
if ((!data_off || !meta_off) && !force) {
clear_bit(CACHE_DEV_REMOVING, &ca->flags);
+ bch_notify_cache_remove_failed(ca);
return;
}