]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
bcache: Fix a shrinker deadlock
authorKent Overstreet <kmo@daterainc.com>
Fri, 30 Aug 2013 21:12:24 +0000 (14:12 -0700)
committerKent Overstreet <kmo@daterainc.com>
Fri, 30 Aug 2013 21:15:19 +0000 (14:15 -0700)
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>
Cc: linux-stable <stable@vger.kernel.org> # >= v3.10
drivers/md/bcache/btree.c

index 60908de2af5f157a02f231014addb7d9fc20ef7f..55e8666f9544f523abfef378c9f32f76c8f9b8f3 100644 (file)
@@ -617,7 +617,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;