diff options
-rw-r--r-- | drivers/md/bcache/btree_update.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/md/bcache/btree_update.c b/drivers/md/bcache/btree_update.c index ad7e3d9790d4..bfbc2964394f 100644 --- a/drivers/md/bcache/btree_update.c +++ b/drivers/md/bcache/btree_update.c @@ -503,6 +503,14 @@ static struct btree_reserve *__bch_btree_reserve_get(struct cache_set *c, if (!check_enospc) flags |= BCH_DISK_RESERVATION_NOFAIL; + /* + * This check isn't necessary for correctness - it's just to potentially + * prevent us from doing a lot of work that'll end up being wasted: + */ + ret = bch_journal_error(&c->journal); + if (ret) + return ERR_PTR(ret); + if (bch_disk_reservation_get(c, &disk_res, sectors, flags)) return ERR_PTR(-ENOSPC); |