From patchwork Wed Jun 21 14:47:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 1797945 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=gbk5=cj=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=spZwbLy7; dkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YS9AuQ78; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QmRFP0Vmkz20Xm for ; Thu, 22 Jun 2023 00:48:09 +1000 (AEST) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4QmRFN6YrCz4x0L for ; Thu, 22 Jun 2023 00:48:08 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4QmRFN6KfVz4x1R; Thu, 22 Jun 2023 00:48:08 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz 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 (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=spZwbLy7; dkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=YS9AuQ78; 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 4QmRFN6FByz4x0L for ; Thu, 22 Jun 2023 00:48:08 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232270AbjFUOsG (ORCPT ); Wed, 21 Jun 2023 10:48:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbjFUOr5 (ORCPT ); Wed, 21 Jun 2023 10:47:57 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB70F1BCB; Wed, 21 Jun 2023 07:47:46 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 570DA1FECB; Wed, 21 Jun 2023 14:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1687358865; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QWUOtp0iwu/9Qa0OVnEO54KvtodKK3z2Yy7Kvf+nwDE=; b=spZwbLy7WTEzmCG4IMRKQcBb3oB/aSMNtEjvoswtRfWZzVDvghsD5pMwYwaZxYquv0jqYf YcAGwzQPCRk3PBncB9u2KOnsFAgy3rxJuwJydd5bw8pFRXy4lzQ+Wz3fp8hSCgE6RCXtAy 34vS7wfHeG2WTI41bOoDyjVMQNkpESY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1687358865; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QWUOtp0iwu/9Qa0OVnEO54KvtodKK3z2Yy7Kvf+nwDE=; b=YS9AuQ78ENZBIpT+YMAxs3pUdZCQBG02Y9BNmpyyomSr+5pEuDZlRnut4qwFav1kcoKNJg xrOBheTKgL0AAQCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3FF70133E6; Wed, 21 Jun 2023 14:47:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ISQRD5ENk2T7EAAAMHmgww (envelope-from ); Wed, 21 Jun 2023 14:47:45 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id C88E1A0439; Wed, 21 Jun 2023 16:47:44 +0200 (CEST) From: Jan Kara To: Jens Axboe Cc: , Christoph Hellwig , , , Jan Kara Subject: [PATCH 1/2] ext4: Fix crash in ext4_bdev_mark_dead() Date: Wed, 21 Jun 2023 16:47:42 +0200 Message-Id: <20230621144744.1580-1-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230621144354.10915-1-jack@suse.cz> References: <20230621144354.10915-1-jack@suse.cz> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=831; i=jack@suse.cz; h=from:subject; bh=fVkRZ23tC1duoGWpYIOUWQFn7i7gXQuatR9LkqpoylM=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBkkw2Nz9dPYRfxuj98FpO6uTFrTKYBBa85oPM//MLy caQyHJuJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCZJMNjQAKCRCcnaoHP2RA2XS/CA CUkx2kfMmw1VtFu0zZfSoq9OorFMl6+eWvqt5avVVd9qqI+jUKlzqcJOuJZkufV0dkWnfUN5XKXMha Hh55mhrpH+G5Hq9Pkwcqk4YCAoHCS9GdIMIe6z2RW6mZo5qfEFOFjr7SgaNk2iDikQTRyFYAVxQfft x37meRh8o2HaGqj1bIbRfeqpbMMYP4BacrIfKM0XHSEuYpDZbXdEiYR+IoYZftU6gOp/lr0V9/nBk2 R4C9TIwZcJK2IEYNvFBjZefwBLuriM90kWdeXwZI4BDZJtViF+UOoyhQhnUUgecMSPkUej5L3fcRu7 Zul/dHMFfegtba8HHutOXxoZlahwT8 X-Developer-Key: i=jack@suse.cz; a=openpgp; fpr=93C6099A142276A28BBE35D815BC833443038D8C X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 ext4_bdev_mark_dead() passes bdev->bd_holder to ext4_force_shutdown() instead of bdev->bd_super leading to crashes. Fix it. Fixes: dd2e31afba9e ("ext4: wire up the ->mark_dead holder operation for log devices") Signed-off-by: Jan Kara --- fs/ext4/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 6f43a86ecf16..53d74144ee34 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1098,7 +1098,7 @@ void ext4_update_dynamic_rev(struct super_block *sb) static void ext4_bdev_mark_dead(struct block_device *bdev) { - ext4_force_shutdown(bdev->bd_holder, EXT4_GOING_FLAGS_NOLOGFLUSH); + ext4_force_shutdown(bdev->bd_super, EXT4_GOING_FLAGS_NOLOGFLUSH); } static const struct blk_holder_ops ext4_holder_ops = { From patchwork Wed Jun 21 14:47:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 1797946 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=gbk5=cj=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=uTLSKksY; dkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Mo3w+XS3; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QmRFP0PlMz20Wk for ; Thu, 22 Jun 2023 00:48:09 +1000 (AEST) Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4QmRFL3f9Dz4x0C for ; Thu, 22 Jun 2023 00:48:06 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4QmRFL3QCqz4x0L; Thu, 22 Jun 2023 00:48:06 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz 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 (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=uTLSKksY; dkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=Mo3w+XS3; 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 4QmRFK6SBpz4x0C for ; Thu, 22 Jun 2023 00:48:05 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232140AbjFUOsD (ORCPT ); Wed, 21 Jun 2023 10:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbjFUOr4 (ORCPT ); Wed, 21 Jun 2023 10:47:56 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D81E31BC1; Wed, 21 Jun 2023 07:47:46 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5E7C91FECC; Wed, 21 Jun 2023 14:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1687358865; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kv6ExZernbSJWI88DpmmcJXjCzsmSh4Zm3LClIhZLBs=; b=uTLSKksY0r8UEg+1g8Guk7dqOeyat14cg0OjNpwTLUzr8cEyCNgHRveIDX2qfxuX9I5a8O hLscMNKvZGF/uIL6xgU2cLqH1V5eM8liwOYtuT/q/o1ITefV0RUCSCkprNILo3KG1pYwKG rM1DNpMVsmBPvigqeeqK8DazC1qf9ls= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1687358865; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kv6ExZernbSJWI88DpmmcJXjCzsmSh4Zm3LClIhZLBs=; b=Mo3w+XS3XfnQSCTYCM6KqnWgFu06AKVmYTKTVxpl0bzwm37SQBq1vn6jyYs5ey/cxTif5R FEKYjbEj/bGSOBDw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 475C213A66; Wed, 21 Jun 2023 14:47:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4lvSEJENk2T+EAAAMHmgww (envelope-from ); Wed, 21 Jun 2023 14:47:45 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id CF439A0762; Wed, 21 Jun 2023 16:47:44 +0200 (CEST) From: Jan Kara To: Jens Axboe Cc: , Christoph Hellwig , , , Jan Kara Subject: [PATCH 2/2] xfs: Fix crash in ext4_bdev_mark_dead() Date: Wed, 21 Jun 2023 16:47:43 +0200 Message-Id: <20230621144744.1580-2-jack@suse.cz> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230621144354.10915-1-jack@suse.cz> References: <20230621144354.10915-1-jack@suse.cz> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=792; i=jack@suse.cz; h=from:subject; bh=9mvZHv1nuxOrQ7jy+yO1dpp1vobf8ZfRCOPCzoekEhM=; b=owEBbQGS/pANAwAIAZydqgc/ZEDZAcsmYgBkkw2O58FKvXZCqoY+XMY4g6hDtZPOPFl/GfUiC1Bg KHkItYSJATMEAAEIAB0WIQSrWdEr1p4yirVVKBycnaoHP2RA2QUCZJMNjgAKCRCcnaoHP2RA2UbvCA C4w8+U/GaomQgaxClF8hYFoz8gIrFJ9yEcmsR4jiuyhD8T1JyS9wX7+KlS3HjsLO0yMpq6Tiu1TLIu rMuFXsEWoTFmzawnh9j8Ym6ryHLu2PnnguqcLul2M7IKrfJuakK7/LrwnKa9BMgIjQebAbI1oUfd97 JOKBnJj2uumSdcan5RnELbs9OPtD643xFk2Wkcq3y5ZMwDO2tRObLNOCAmifbaNcTYLE9PVHV2Szkr KPUtLZFf6f4u++NPZTNoMqwJBANNEQfNBM2rogqGpDPbLFoNsTlpluDjAbns/DW6mnVpVBVOLXrwve XDW/WoZFXW7i3uyCpEXCE3fmJXkuAY X-Developer-Key: i=jack@suse.cz; a=openpgp; fpr=93C6099A142276A28BBE35D815BC833443038D8C X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 xfs_bdev_mark_dead() passes bdev->bd_holder to ext4_force_shutdown() instead of bdev->bd_super leading to crashes. Fix it. Fixes: 8067ca1dcdfc ("xfs: wire up the ->mark_dead holder operation for log and RT devices") Signed-off-by: Jan Kara --- fs/xfs/xfs_super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index d910b141d52e..3ab188a6fba1 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -381,7 +381,7 @@ static void xfs_bdev_mark_dead( struct block_device *bdev) { - xfs_force_shutdown(bdev->bd_holder, SHUTDOWN_DEVICE_REMOVED); + xfs_force_shutdown(XFS_M(bdev->bd_super), SHUTDOWN_DEVICE_REMOVED); } static const struct blk_holder_ops xfs_holder_ops = {