Received: by 2002:ab2:68c1:0:b0:1fd:9a81:d0e4 with SMTP id e1csp41267lqp; Sat, 8 Jun 2024 05:34:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXb2xB6lgASWMJt6JETGW4CzSpqBUGH7aO+AGveXqBupWGV2UHKF3ci4YkusGAVQ/sf3pbZnB5U5m0Jjj8W1Gc1GYocgs24mXVKf3xNEg== X-Google-Smtp-Source: AGHT+IGNKZhFNoY/awyGr9iSwlTIgzlcXEfigltkMpct3G6M7k/d/lZSvIHN1EOU+zVRuQ8a89+Q X-Received: by 2002:a50:ab1a:0:b0:57c:6c98:b61f with SMTP id 4fb4d7f45d1cf-57c6c98b88emr840547a12.42.1717850098422; Sat, 08 Jun 2024 05:34:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717850098; cv=pass; d=google.com; s=arc-20160816; b=p1za2R/d874iE1xOIF8wrHuTMVrVa9gO5q8WBoyoywFwVmvfs9fuZzunrM0ijp4v4Q IxDss8jpP0O0ihc9uVWGrJqUEGVg+E85/gstc7wxtwZWywflukPhtI5OPw4LU0yHcfpR NXiP9hpoD4y5QUUYwiEKZ6kDB1y6ZFNaBwt0gJDizDSSHv7Wjg54JbRtLF3gE994k0qR jX9BaTdirerWYK3iPeRRL3OD98HGBbTvVZ+DQ2mjkVO9QlD/J9x6dWXKdtwvl7wxvZf0 F5XBF1qMIZy8lyPCV9Cif4scTI9TIU9/9TpvsP76PdrL/Z82RUTbyR5ejRewpJr6VrQv SgUg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=CojGfRS7sUwc049QCzJ4+zz7u7AH6qcToL3ZgwieWrE=; fh=fgVYWRzhbkznfQJoL8hnxMWwScvFWxfJ3umnVk3XLnA=; b=je2JJL4LScgYp3plrNa0alwe0YhQiknHDpPyT85gA2Pj80LfggSKBeZex1a3Uxp3Rp xCfmBfwh1LZeSaaA/arPacd3H4FImjoG+8P35g302+cabYN/EDi6FHBmPR26kJWqwXPD +XsngyL1k8k1fbOdwBQxJUWkiJcaB3I7OIaED9XJfFQx6kd2XE4N6pYWj4fX8ux8au8q t2UUq+Bv9SQdX2QLxmQeJSwVbEuwVjdMm5TQ5T/Yj5LYqsgWZOhVunWnxxam0cg8atEi rE5OZW2R+uoIUpv2ogKFUEzerRMGDHlBJE9zHBQUsPNB3sQT6JZMXhDPPkxjxM5nFEwg xlzA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DwC4KbLO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207032-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207032-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57c694ea680si824843a12.325.2024.06.08.05.34.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jun 2024 05:34:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207032-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DwC4KbLO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-207032-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207032-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 274291F21DC1 for ; Sat, 8 Jun 2024 12:34:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1C3A55896; Sat, 8 Jun 2024 12:34:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DwC4KbLO" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E263175AA for ; Sat, 8 Jun 2024 12:34:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717850090; cv=none; b=lpxUN40J0rHVZgkDxKIWIY2Nsk1g3IKIWN2dHIkfiB9XucoC2U8C6ijzwBzsp4Ioz0rBT160pWmFzksdUnyPXn5WSeuUSC4E1Ly2xzGtiVGVIv6SxpsAt2Iep2yIVI3eu2bIZHtxiWSe7/juf/Fgsbop8Zrtp3Yx8TgjM0wxf+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717850090; c=relaxed/simple; bh=vPnMjqtol+dnoSheDRAOwf/tp0qa9MOgByaRrsa0Kz4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=t8KGd5HxU6qqzTtuu/4lx4EYWtyQeT9YE7R6QfoklUMasvXpATCcmfBvxohydUdt2DXbIsYsWPFaF/Wypl+Wfs//KKVDjlGAt+I/5YrATWFPfNRQPiifFoB+3fOjylkR32pZkTCLFTFM1ON57bu8tBEc3FNXcFk+0tSm7b8RT9s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DwC4KbLO; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5E5BC2BD11; Sat, 8 Jun 2024 12:34:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717850089; bh=vPnMjqtol+dnoSheDRAOwf/tp0qa9MOgByaRrsa0Kz4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=DwC4KbLO4rn2JODKiRd5J1mgfZh1CbPIIqTbOa8bxEKdpcHw442Do+yleTF/z2utD E9oK+JJ8lWeOQ6gkKwwg9SN8AyV9NaAg8cpSLQjwZzKKrYc0111e0676+xGgnP/Lft LOJc9oksAVQ89z3RZq+JMVFsJwnV3QesH3pi019rt/m8wMqlgQX2ZdbtTnPxRJpCM2 wiWg+3jZ89nom0zb1QEyQBiE380RHyeYltxtXa0GAW60N3tIzORggmuqYH7u1la5wL CkuAf11ke5Z9YBE0j06noRMapgl9TcIgry362Y6qhk5LkYai1ZpcF9biHuIw/y46Kf 5cpV66feT9wbw== Message-ID: Date: Sat, 8 Jun 2024 20:34:47 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] f2fs: fix to add missing sb_{start,end}_intwrite() for ckpt thread To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Daeho Jeong References: <20240606095213.4087668-1-chao@kernel.org> Content-Language: en-US From: Chao Yu Autocrypt: addr=chao@kernel.org;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zbfvMI9o/kFlOu8iTGlD8sNjJK+Y/fPK3znFqoqqKmSFZ aiRALjAZH6ufspvYAJEJE9eZSX7Rtdyt30MMHQARAQABwsFfBBgBCgAJBQJWLOm1AhsMAAoJ EKTPgB1/p52GPpoP/2LOn/5KSkGHGmdjzRoQHBTdm2YV1YwgADg52/mU68Wo6viStZqcVEnX 3ALsWeETod3qeBCJ/TR2C6hnsqsALkXMFFJTX8aRi/E4WgBqNvNgAkWGsg5XKB3JUoJmQLqe CGVCT1OSQA/gTEfB8tTZAGFwlw1D3W988CiGnnRb2EEqU4pEuBoQir0sixJzFWybf0jjEi7P pODxw/NCyIf9GNRNYByUTVKnC7C51a3b1gNs10aTUmRfQuu+iM5yST5qMp4ls/yYl5ybr7N1 zSq9iuL13I35csBOn13U5NE67zEb/pCFspZ6ByU4zxChSOTdIJSm4/DEKlqQZhh3FnVHh2Ld eG/Wbc1KVLZYX1NNbXTz7gBlVYe8aGpPNffsEsfNCGsFDGth0tC32zLT+5/r43awmxSJfx2P 5aGkpdszvvyZ4hvcDfZ7U5CBItP/tWXYV0DDl8rCFmhZZw570vlx8AnTiC1v1FzrNfvtuxm3 92Qh98hAj3cMFKtEVbLKJvrc2AO+mQlS7zl1qWblEhpZnXi05S1AoT0gDW2lwe54VfT3ySon 8Klpbp5W4eEoY21tLwuNzgUMxmycfM4GaJWNCncKuMT4qGVQO9SPFs0vgUrdBUC5Pn5ZJ46X mZA0DUz0S8BJtYGI0DUC/jAKhIgy1vAx39y7sAshwu2VILa71tXJ In-Reply-To: <20240606095213.4087668-1-chao@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/6/6 17:52, Chao Yu wrote: > After commit 261eeb9c1585 ("f2fs: introduce checkpoint_merge mount > option"), checkpoint can be triggered in background thread, it missed > to cover f2fs inner checkpoint operation w/ sb_{start,end}_intwrite(), > fix it. It needs to use sb_start_intwrite_trylock(), otherwise, it will cause deadlock as below: - freeze_super - sb_wait_write(SB_FREEZE_WRITE) - sb_wait_write(SB_FREEZE_PAGEFAULT) - sb_wait_write(SB_FREEZE_FS) - sync - iterate_supers - super_lock_shared - down_read(&sb->s_umount) - sync_fs_one_sb - f2fs_sync_fs - f2fs_issue_checkpoint - wait_for_completion - issue_checkpoint_thread - sb_start_intwrite(sbi->sb); - thaw_super - super_lock_excl - down_write(&sb->s_umount) Thanks, > > Fixes: 261eeb9c1585 ("f2fs: introduce checkpoint_merge mount option") > Cc: Daeho Jeong > Signed-off-by: Chao Yu > --- > fs/f2fs/checkpoint.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c > index 55d444bec5c0..66eaad591b60 100644 > --- a/fs/f2fs/checkpoint.c > +++ b/fs/f2fs/checkpoint.c > @@ -1828,8 +1828,11 @@ static int issue_checkpoint_thread(void *data) > if (kthread_should_stop()) > return 0; > > - if (!llist_empty(&cprc->issue_list)) > + if (!llist_empty(&cprc->issue_list)) { > + sb_start_intwrite(sbi->sb); > __checkpoint_and_complete_reqs(sbi); > + sb_end_intwrite(sbi->sb); > + } > > wait_event_interruptible(*q, > kthread_should_stop() || !llist_empty(&cprc->issue_list));