[{"id":3675050,"web_url":"http://patchwork.ozlabs.org/comment/3675050/","msgid":"<6864da80-b244-4444-aecd-2555c2d60db0@huaweicloud.com>","list_archive_url":null,"date":"2026-04-09T02:45:14","subject":"Re: [PATCH] jbd2: fix deadlock in jbd2_journal_cancel_revoke()","submitter":{"id":85428,"url":"http://patchwork.ozlabs.org/api/people/85428/","name":"Zhang Yi","email":"yi.zhang@huaweicloud.com"},"content":"Please ignore this patch; this solution does not correct.\n\nBest Regards.\nYi.\n\nOn 4/9/2026 9:07 AM, Zhang Yi wrote:\n> From: Zhang Yi <yi.zhang@huawei.com>\n> \n> Commit f76d4c28a46a (\"fs/jbd2: use sleeping version of\n> __find_get_block()\") changed jbd2_journal_cancel_revoke() to use\n> __find_get_block_nonatomic() which holds the folio lock instead of\n> i_private_lock. This breaks the lock ordering (folio -> buffer) and\n> causes an ABBA deadlock when the filesystem blocksize < pagesize:\n> \n>      T1                                T2\n> ext4_mkdir()\n>  ext4_init_new_dir()\n>   ext4_append()\n>    ext4_getblk()\n>     lock_buffer()    <- A\n>                                    sync_blockdev()\n>                                     blkdev_writepages()\n>                                      writeback_iter()\n>                                       writeback_get_folio()\n>                                        folio_lock()   <- B\n>      ext4_journal_get_create_access()\n>       jbd2_journal_cancel_revoke()\n>        __find_get_block_nonatomic()\n>         folio_lock()  <- B\n>                                      block_write_full_folio()\n>                                       lock_buffer()   <- A\n> \n> This can occasionally cause generic/013 to hang.\n> \n> Fix by only calling __find_get_block_nonatomic() when the passed\n> buffer_head doesn't belong to the bdev (i.e., !bh->b_bdev), which is the\n> only case that we need to look up its bdev alias. Otherwise, the lookup\n> is redundant since the found buffer_head is equal to the one we passed\n> in.\n> \n> Fixes: f76d4c28a46a (\"fs/jbd2: use sleeping version of __find_get_block()\")\n> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>\n> ---\n>  fs/jbd2/revoke.c | 7 ++++---\n>  1 file changed, 4 insertions(+), 3 deletions(-)\n> \n> diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c\n> index 9016ddb82447..8b52d40c27c9 100644\n> --- a/fs/jbd2/revoke.c\n> +++ b/fs/jbd2/revoke.c\n> @@ -464,13 +464,14 @@ void jbd2_journal_cancel_revoke(handle_t *handle, struct journal_head *jh)\n>  \t * buffer_head?  If so, we'd better make sure we clear the\n>  \t * revoked status on any hashed alias too, otherwise the revoke\n>  \t * state machine will get very upset later on. */\n> -\tif (need_cancel) {\n> +\tif (need_cancel && !bh->b_bdev) {\n>  \t\tstruct buffer_head *bh2;\n> +\n>  \t\tbh2 = __find_get_block_nonatomic(bh->b_bdev, bh->b_blocknr,\n>  \t\t\t\t\t\t bh->b_size);\n>  \t\tif (bh2) {\n> -\t\t\tif (bh2 != bh)\n> -\t\t\t\tclear_buffer_revoked(bh2);\n> +\t\t\tWARN_ON_ONCE(bh2 == bh);\n> +\t\t\tclear_buffer_revoked(bh2);\n>  \t\t\t__brelse(bh2);\n>  \t\t}\n>  \t}","headers":{"Return-Path":"\n <SRS0=q3OG=CI=vger.kernel.org=linux-ext4+bounces-15691-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ext4@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=150.107.74.76; helo=mail.ozlabs.org;\n envelope-from=srs0=q3og=ci=vger.kernel.org=linux-ext4+bounces-15691-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=172.234.253.10 arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15691-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=45.249.212.51","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=huaweicloud.com"],"Received":["from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4frkvJ4thxz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 12:50:35 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4frkvH4Wyzz4wSs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 09 Apr 2026 12:50:35 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4frkvH4ShYz4wSV; Thu, 09 Apr 2026 12:50:35 +1000 (AEST)","from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4frkvD0qGhz4wT7\n\tfor <patchwork-incoming@ozlabs.org>; Thu, 09 Apr 2026 12:50:32 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id AD911300F9F7\n\tfor <patchwork-incoming@ozlabs.org>; Thu,  9 Apr 2026 02:45:24 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id B5BB1352C39;\n\tThu,  9 Apr 2026 02:45:23 +0000 (UTC)","from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com\n [45.249.212.51])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A93E34F26F;\n\tThu,  9 Apr 2026 02:45:20 +0000 (UTC)","from mail.maildlp.com (unknown [172.19.163.198])\n\tby dggsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4frkmV0KnZzYQtgS;\n\tThu,  9 Apr 2026 10:44:42 +0800 (CST)","from mail02.huawei.com (unknown [10.116.40.112])\n\tby mail.maildlp.com (Postfix) with ESMTP id 2AB4640561;\n\tThu,  9 Apr 2026 10:45:17 +0800 (CST)","from [10.174.178.253] (unknown [10.174.178.253])\n\tby APP1 (Coremail) with SMTP id cCh0CgBHSdm7EtdpP26YDw--.24580S3;\n\tThu, 09 Apr 2026 10:45:16 +0800 (CST)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1775703035; cv=pass;\n\tb=hKWYsO1KdEtQwEuZw7jpCnaychiCrowXR4AA9/2ObYcBw6D3+SDiWEuKNAOuLrP/0edOoCLfCEk2CUJv5XoBrR8hEXseqZH+16kLvxaRxk96kmymIt/CWdlkphsVeIJMiSVRToUyEsWTWWf7UEy5GvrSdQmE8jezrhQlpCGJkunQClL32qOfsvWOe/NW4V/DKbDKRn+YbFbWZlMwdBjYb6rbmfBtU8PoEp1fAIyFWw1ZL7DjTpw2AL4U5b9W7nMaphbRqWKjW8fad6Ma7QnZjR/PQZa5/AhsPIUEINm1bsOZJyQMHytbXynP1KsUSNOMb5MgYysMjw1+BmT2YSKINQ==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775702723; cv=none;\n b=m2jptE2T6cgbubA072x7iLfYsh32NrFf9vzeoo1wM1NRNwnxbYCKC9WeBUCNSoD7uzEY42CHusJBEacH59cf12Q776dRUoPdMsNEtEtVDnFgkUkpMtHAQfYp3VQPSnFsjkM6znoo6EHh1mHuqu50hRS0HurNxAV/20J1uRqLSWw="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1775703035; c=relaxed/relaxed;\n\tbh=2yijzEuOdWmiZneJFOCMKnWK4vCj0U/Pp6pEQNkrBw0=;\n\th=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:\n\t In-Reply-To:Content-Type;\n b=V9/bYwMfF0QPRy27ZURqx50bIvsqDCSfwg/ZucIbHARLAthBGecYg5SY3UnMpgKSoqiXqhddgwopWKUgW65vKxgcgaBXnrCAiIH2Mh10ffzZKOzmj4drrJ5Wl5NfJHUi1T/Lz3bf7dw742JH19GCtLTufo7Zt1O2QrH4NI9kBmP4Val961u1uxTKhtNPSAe9KPi2eOYZxLXDy2TI5RH7D90bwru9kkHZZZepEJw4IG1j9s01FiJP3rvGuKhKvhlQ/Q7ByyKSgJuHSEMfE8oPWphxMYUGQIZm/vt0oLHfBmrV+PrUMOHSf/OrWnHxYbBhz+N06MeOES/CkkqWocYlQg==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775702723; c=relaxed/simple;\n\tbh=42jt/B1x0R/zhB+VrV+Mn2VfwG5trZJy9L0IrlmuAvE=;\n\th=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:\n\t In-Reply-To:Content-Type;\n b=i4kZm/k3KB747sF12aEaxdBC/AvkndNsU1XNEqe4qPDeRdIaXzlBCvGqDoSrqs09dZyLUPjMhNG8eZ9JS5LVtb0fLVAydImZ2hltrS1gL5OllBjFI8/pCmRwgsGY/WoDMcw0+lS7cKd+Zsn+gBM4nl4a8unXywCD5Gb6b5eK2T4="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-15691-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=huaweicloud.com;\n spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51"],"Message-ID":"<6864da80-b244-4444-aecd-2555c2d60db0@huaweicloud.com>","Date":"Thu, 9 Apr 2026 10:45:14 +0800","Precedence":"bulk","X-Mailing-List":"linux-ext4@vger.kernel.org","List-Id":"<linux-ext4.vger.kernel.org>","List-Subscribe":"<mailto:linux-ext4+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ext4+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] jbd2: fix deadlock in jbd2_journal_cancel_revoke()","To":"linux-ext4@vger.kernel.org","Cc":"linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,\n dave@stgolabs.net, tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz,\n ojaswin@linux.ibm.com, ritesh.list@gmail.com, libaokun@linux.alibaba.com,\n yi.zhang@huawei.com, yizhang089@gmail.com, yangerkun@huawei.com,\n yukuai@fnnas.com","References":"<20260409010730.5508-1-yi.zhang@huaweicloud.com>","Content-Language":"en-US","From":"Zhang Yi <yi.zhang@huaweicloud.com>","In-Reply-To":"<20260409010730.5508-1-yi.zhang@huaweicloud.com>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"7bit","X-CM-TRANSID":"cCh0CgBHSdm7EtdpP26YDw--.24580S3","X-Coremail-Antispam":"1UD129KBjvJXoW7CrykXryrXFyfCr1rWF15Jwb_yoW8trW7pr\n\t90kF1YkrWDuFyqk3ZrWFy5X3Z7Cw1kGryUWFZxuwnrCr45XrnIgFZ2gw1aqFyjqrsrXr4k\n\tXF4Ut3yrua10vFDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjb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O_NONE,SPF_PASS autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"}}]