Whamcloud - gitweb
EX-7601 osc: replace assert with error
authorPatrick Farrell <pfarrell@whamcloud.com>
Mon, 13 Nov 2023 04:20:01 +0000 (23:20 -0500)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 24 Nov 2023 09:29:29 +0000 (09:29 +0000)
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 <pfarrell@whamcloud.com>
Change-Id: Icda213e3c5a90a848c9b008788e92ee49e2efcb1
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53108
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/osc/osc_compress.c

index a99741c..3465546 100644 (file)
@@ -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);