From patchwork Mon Nov 7 12:21:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ritesh Harjani (IBM)" X-Patchwork-Id: 1700575 X-Patchwork-Delegate: tytso@mit.edu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=bncz=3h=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Iz1aVJ1n; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4N5VnB2bbJz23lW for ; Mon, 7 Nov 2022 23:25:34 +1100 (AEDT) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4N5VnB28rTz4xDK for ; Mon, 7 Nov 2022 23:25:34 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4N5VnB26Jdz4xGj; Mon, 7 Nov 2022 23:25:34 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Iz1aVJ1n; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4N5VnB22rbz4xDK for ; Mon, 7 Nov 2022 23:25:34 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232199AbiKGMZc (ORCPT ); Mon, 7 Nov 2022 07:25:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232146AbiKGMZR (ORCPT ); Mon, 7 Nov 2022 07:25:17 -0500 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E893314D05 for ; Mon, 7 Nov 2022 04:25:16 -0800 (PST) Received: by mail-pf1-x429.google.com with SMTP id y13so10442838pfp.7 for ; Mon, 07 Nov 2022 04:25:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IfEeEEDfQCyUEF0iTzgW5irU43t9MpNBB/mcyhT3TkI=; b=Iz1aVJ1nXiNshUDdVU9mpVLufYdsHQhBslODYVRTTpwxupIhE5220aToKmjJecIqJF KaN+wuHRUttD9p0cVl/3f83J6Q8sF3WlxPVRmFqtshws/VzPDmVyMfIb/oGLVzcYR88h qwMbaqyxz7x49CgVZNVApPgsJsr9fpi6lS3nG2Kr9pjT7fmXIIxIZJNyIJdmHM8QSQ1P zSc9t31fadDT7cKEmwjAZHHbezu4W91yTEaWN3wXEvmPlq384r8ma29yeeRjWnm9cX7Q KBivDSykk2mXtDLxz66ddu+YNLUBFS/uli6yTrlCyW4LLYmEys7R/CEDqXBXLkhQEJoq vg4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IfEeEEDfQCyUEF0iTzgW5irU43t9MpNBB/mcyhT3TkI=; b=s7fFMxh+4ihw0dHT68WVcPu+fBC63k0lCCMDwaIlzFYOsdKuenma5o/nnVyDzknmQa 4IZJryK6NmD6UFV/pt5AEqah5qRVQpiVCftN8VIClJ//0MQJA+rLxYEJ/obZaa9mUPvQ zrbluPo60u+CU37U41Bx8XlE6DGTwDLUukvt7EFQHnVXl1JOy4MtoHgVQEYy3yfUkf8Y kRAqqqc2cQwK1jDAO9IKFM4DsT8EzFfGzOjRMC/g8NOIeaiDLazqoxzpADKBfzG741dp SD/1f9MFaSn8mPvODofz2KSTQpGQsWq1HDqJHXVThf0P3W/SHs68QqBWbu+PHU86dqDK v7LA== X-Gm-Message-State: ANoB5pmvM5LA2supm40fpHuFdoHZ6kBNfZGe6RaIi3YE4iu/ZfQSr+U8 yPb/YBv+7wk1LhDIZGFMRd0= X-Google-Smtp-Source: AA0mqf47GaxC3ZTW6XixEcicI/nVoTZl7n8X/5ulj5NDxLsxbK/8Wl+GvkqOO8AUPxgl7pTbE5yzOA== X-Received: by 2002:a63:1607:0:b0:470:6934:e853 with SMTP id w7-20020a631607000000b004706934e853mr7151836pgl.237.1667823916334; Mon, 07 Nov 2022 04:25:16 -0800 (PST) Received: from localhost ([2406:7400:63:f20b:312d:45b2:85c1:c486]) by smtp.gmail.com with ESMTPSA id y28-20020aa79afc000000b005627ddbc7a4sm4364810pfp.191.2022.11.07.04.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 04:25:15 -0800 (PST) From: "Ritesh Harjani (IBM)" To: Theodore Ts'o Cc: linux-ext4@vger.kernel.org, Harshad Shirwadkar , Wang Shilong , Andreas Dilger , Li Xi , Ritesh Harjani Subject: [RFCv1 28/72] e2fsck: Add asserts in open_channel_fs Date: Mon, 7 Nov 2022 17:51:16 +0530 Message-Id: X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Li Xi Signed-off-by: Li Xi Signed-off-by: Ritesh Harjani (IBM) --- e2fsck/pass1.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 9a273515..ea432ff2 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -2190,6 +2190,18 @@ static errcode_t e2fsck_open_channel_fs(ext2_filsys dest, e2fsck_t dest_context, io_channel_set_blksize(dest->io, src->io->block_size); ehandler_init(dest->io); + assert(dest->io->magic == src->io->magic); + assert(dest->io->manager == src->io->manager); + assert(strcmp(dest->io->name, src->io->name) == 0); + assert(dest->io->block_size == src->io->block_size); + assert(dest->io->read_error == src->io->read_error); + assert(dest->io->write_error == src->io->write_error); + assert(dest->io->refcount == src->io->refcount); + assert(dest->io->flags == src->io->flags); + assert(dest->io->app_data == dest); + assert(src->io->app_data == src); + assert(dest->io->align == src->io->align); + dest->priv_data = dest_context; dest_context->fs = dest; /* The data should be written to disk immediately */