From: Patrick Farrell Date: Mon, 13 Nov 2023 04:20:01 +0000 (-0500) Subject: EX-7601 osc: replace assert with error X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7f95816aa0877b750a9250239ddd9b8392e0f016;p=fs%2Flustre-release.git EX-7601 osc: replace assert with error We shouldn't assert on values read from storage, instead if they are incorrect, we should give EIO. Test-Parameters: trivial Signed-off-by: Patrick Farrell Change-Id: Icda213e3c5a90a848c9b008788e92ee49e2efcb1 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53108 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/osc/osc_compress.c b/lustre/osc/osc_compress.c index a99741c..3465546 100644 --- a/lustre/osc/osc_compress.c +++ b/lustre/osc/osc_compress.c @@ -290,8 +290,16 @@ int decompress_request(struct osc_brw_async_args *aa, int page_count) rpc_chunk_bits = llch->llch_chunk_log_bits + COMPR_CHUNK_MIN_BITS; - /* the chunk bits in every chunk should be the same */ - LASSERT(rpc_chunk_bits == chunk_bits); + /* the chunk bits from storage must be the same as from + * the layout (but don't assert on it, since it comes + * from storage and could potentially be corrupted) + */ + if (rpc_chunk_bits != chunk_bits) { + CERROR( + "chunk bits from storage (%d) and layout (%d) disagree\n", + rpc_chunk_bits, chunk_bits); + GOTO(out, rc = -EIO); + } CDEBUG(D_SEC, "chunk_size: %i, pages_in_chunk: %i\n", chunk_size, pages_in_chunk);