summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlava Pestov <sp@daterainc.com>2015-01-31 18:28:21 -0800
committerKent Overstreet <kmo@daterainc.com>2015-02-12 23:43:30 -0800
commitc725b10f3e0a5ac4fb4ef1490d464ba02348ee54 (patch)
treee982bd32715b8b400a8bcd42e8ba3591b9ed9a67
parent55202bc29f4e378c6e429bfe06325818396ee496 (diff)
bcache: add remove_failed notification
Change-Id: I1c2b68248eefd77b48fc5deb15e2908db6ef3f28
-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 8188ee795f2a..ebb01d9c499a 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 fa138439f1f9..74e3b0970f6c 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1681,6 +1681,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;
}
@@ -1779,6 +1780,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;
}