bcache: Fix a bug when detaching
authorKent Overstreet <kmo@daterainc.com>
Thu, 20 Mar 2014 00:49:37 +0000 (17:49 -0700)
committerKent Overstreet <kmo@daterainc.com>
Mon, 4 Aug 2014 22:23:02 +0000 (15:23 -0700)
After detaching a backing device from a cache set, a bit wasn't getting
reset meaning the second detach wouldn't work correctly.

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
drivers/md/bcache/super.c

index 926ded8ccbf58c39788a471dffb4ed7f876028bc..1ea9fa27ee3c71487e77019ae1fd8117175632c9 100644 (file)
@@ -927,6 +927,7 @@ static void cached_dev_detach_finish(struct work_struct *w)
        list_move(&dc->list, &uncached_devices);
 
        clear_bit(BCACHE_DEV_DETACHING, &dc->disk.flags);
+       clear_bit(BCACHE_DEV_UNLINK_DONE, &dc->disk.flags);
 
        mutex_unlock(&bch_register_lock);
 
@@ -1405,9 +1406,11 @@ static void cache_set_flush(struct closure *cl)
                if (ca->alloc_thread)
                        kthread_stop(ca->alloc_thread);
 
-       cancel_delayed_work_sync(&c->journal.work);
-       /* flush last journal entry if needed */
-       c->journal.work.work.func(&c->journal.work.work);
+       if (c->journal.cur) {
+               cancel_delayed_work_sync(&c->journal.work);
+               /* flush last journal entry if needed */
+               c->journal.work.work.func(&c->journal.work.work);
+       }
 
        closure_return(cl);
 }
This page took 0.025196 seconds and 5 git commands to generate.