Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1520727rwr; Thu, 27 Apr 2023 20:17:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5/F2m7IJG6KGUn4oNbrp1K7tvO8SPBiFSPdcCyVslyuZUyUwGSraqwA8ndChwRnfpEQcy6 X-Received: by 2002:a05:6a00:1a42:b0:63d:45f3:9fc with SMTP id h2-20020a056a001a4200b0063d45f309fcmr4483486pfv.5.1682651825424; Thu, 27 Apr 2023 20:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682651825; cv=none; d=google.com; s=arc-20160816; b=rr9aBlXb1niOMmXdTm1vT+wFCAwWJmGhT8oGd2uco504vZaPqIn+HKOvAJSPH5yMmi WIMmhpJTffDNjtiPUQvLWvxn3Jq0QfKceTPR89x8ynL1yjK39uWYtsofUhCZjkd2Ht0W nI0+YMM+oVnrS/aB5YTDTFLYtm4NN9LGmkaPXj14wwN2RUovXCsl2CBKbVejUthVGk2Q oFIHzaKK5mpeo7EX9RioP5rAq3iCv3eT5p3MQpYM//Y8Ve4/hEuqiFXgs3F4GQyedy1N zoEcEkkwzzM01Rj3WnUKlijJyzOvMdtBSXk41q1xcRoxEUO/RWOe/UoLbuLfvGUjW5/q PkUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=CiDfb1KbcVMW3QMUCm+CO5W3wvstfq8sN26307vZdlc=; b=f4JkMBv0qta0jnQoqaU2AHsupkxbm5TPbPPGW/x3oIRV2vo9GfRSre1GHTtJHUiui8 uiUw9OWjqgWrcqzhDbeGUPWyrP1BhfgwhoaCgcmPm0KkHs1yiKKpTcLLEBRdBt7Zy0Vu zqOzy7UGpOM8gteynYlHx9ecNnA0nQx5sXA18Oh07p52s2lVkEGIXENet5ZRawNnaSOd Cgbt3INOK8SjOES+EED1eouS9zNlzbhQoPWC10dIA4bKj5UK56UHKqgoe5EwRAyET4/c W/pKXeK/kGIPpUsP+qd82JXZf0EEOx4BdGtIMDS+T5tKeuXyfChUaKZyBAiPCUcF8e6v mNlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b=J0AqLbgb; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h5-20020a625305000000b0063b1b437e53si20633605pfb.306.2023.04.27.20.16.50; Thu, 27 Apr 2023 20:17:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@mit.edu header.s=outgoing header.b=J0AqLbgb; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mit.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345076AbjD1DQn (ORCPT + 99 others); Thu, 27 Apr 2023 23:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345065AbjD1DQf (ORCPT ); Thu, 27 Apr 2023 23:16:35 -0400 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F78D3584 for ; Thu, 27 Apr 2023 20:16:33 -0700 (PDT) Received: from cwcc.thunk.org (pool-173-48-120-46.bstnma.fios.verizon.net [173.48.120.46]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 33S3GFdr012366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Apr 2023 23:16:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing; t=1682651780; bh=CiDfb1KbcVMW3QMUCm+CO5W3wvstfq8sN26307vZdlc=; h=From:To:Cc:Subject:Date; b=J0AqLbgbx21FkSJG/etOfrkS6lQnqg2/oO2M8sZO3XeDcJXBYmcIG4b77/Lkze4uG GC8vJEAI9jUMu8HhR8rY3WDmtU9AkqSKpvMr/luX26vjlCK9e8lRnqZAFm4HcmnGai 379xihGdzN71diUibzPphfqPoYXifPCF0QnqhGFM32EklhZRwFpkyBBHkcuVNIA28c mbL/w6QHZIn1VOt9uPRfyCwkWwGqUHpRbm60BW7zwihl8uzcKty+nV2ol4f4qLRjOC 27olgXbgBsm0JZoOMLvIkd8DrRoRYJIchL4Jz/4y8gRHGUgzgPN75Xv1IH9B+VMM9I Mka/2di8ZQ0iQ== Received: by cwcc.thunk.org (Postfix, from userid 15806) id A97EE15C3AC2; Thu, 27 Apr 2023 23:16:15 -0400 (EDT) From: "Theodore Ts'o" To: Ext4 Developers List Cc: Andreas Dilger , Jason Yan , "Theodore Ts'o" Subject: [PATCH 0/3] ext4: clean up error handling Date: Thu, 27 Apr 2023 23:15:59 -0400 Message-Id: <20230428031602.242297-1-tytso@mit.edu> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 The recent code cleanup of __ext4_fill_super() resulted in a bug reported by Syzkaller. When I investigated this issue, I found that the bug was caused by a fragile and partially redundant way error codes were set to be returned by the __ext4_fill_super() function. The first patch fixes the bug found by Syzkaller, and the second and third patch cleans up the error handling in __ext4_fill_super() and __ext4_multi_mount_protect(). Andreas, please take a look at the second patch, as it changes the error codes returned in various cases when the MMP feature prevents the file system from being mounted and other failure cases. For example, when another system has the file system mounted, mount will now return EBUSY instead EINVAL. In other cases, if a memory allocation fails, mount will now return ENOMEM instead of EINVAL. I think this is an improvement, but there might be some userspace code that might get confused by this. Since Lustre users tend to be most common users of the MMP feature, I'd appreciate your review of this patch. Theodore Ts'o (3): ext4: fix lost error code reporting in __ext4_fill_super() ext4: reflect error codes from ext4_multi_mount_protect() to its callers ext4: clean up error handling in __ext4_fill_super() fs/ext4/mmp.c | 9 ++++++- fs/ext4/super.c | 68 +++++++++++++++++++++++++++++-------------------- 2 files changed, 48 insertions(+), 29 deletions(-) -- 2.31.0