]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
bcache: Fix a shrinker deadlock
authorKent Overstreet <kmo@daterainc.com>
Tue, 24 Sep 2013 06:17:34 +0000 (23:17 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2013 14:13:09 +0000 (07:13 -0700)
commit a698e08c82dfb9771e0bac12c7337c706d729b6d upstream.

GFP_NOIO means we could be getting called recursively - mca_alloc() ->
mca_data_alloc() - definitely can't use mutex_lock(bucket_lock) then.
Whoops.

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/bcache/btree.c

index 833c590806ba6b4bcd39e2cf453e245b3d4ae373..7d3deab11fce3b86f1d8a9832c1638ee7b5a4615 100644 (file)
@@ -633,7 +633,7 @@ static int bch_mca_shrink(struct shrinker *shrink, struct shrink_control *sc)
                return mca_can_free(c) * c->btree_pages;
 
        /* Return -1 if we can't do anything right now */
-       if (sc->gfp_mask & __GFP_WAIT)
+       if (sc->gfp_mask & __GFP_IO)
                mutex_lock(&c->bucket_lock);
        else if (!mutex_trylock(&c->bucket_lock))
                return -1;