From: Jan Kara Date: Tue, 5 Nov 2019 16:44:28 +0000 (+0100) Subject: jbd2: Make credit checking more strict X-Git-Tag: v5.5-rc1~120^2~11^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d090707edab59cb07047d6d7e138ffcc3bdc42be;p=thirdparty%2Fkernel%2Flinux.git jbd2: Make credit checking more strict Make checking of available credits in jbd2_journal_dirty_metadata() more strict. There should be always enough credits in the handle to write all potential revoke descriptors. Also we warn in case there are not enough credits since this is a bug in the filesystem. Reviewed-by: Theodore Ts'o Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20191105164437.32602-22-jack@suse.cz Signed-off-by: Theodore Ts'o --- diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 10fd802fd2229..8f11b2d48ca0e 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -1477,7 +1477,7 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) * of the transaction. This needs to be done * once a transaction -bzzz */ - if (handle->h_total_credits <= 0) { + if (WARN_ON_ONCE(jbd2_handle_buffer_credits(handle) <= 0)) { ret = -ENOSPC; goto out_unlock_bh; }