Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp2031919lqe; Tue, 9 Apr 2024 07:47:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXtlI677aokY3nsfhAnt7/oSLWMau4rSn19En1gv41aYUjKvKVYdoK7cbv+TWXop4+8x8VHJZp0uviAEZzPneI2XOsROb2C3j+hH4ZOJA== X-Google-Smtp-Source: AGHT+IGyCITxgos3ulrJ/h2JUSEzynO286JQtkZh0NY4vHpZ/FeIdJU+t24bbD0F1lsm22YgtlRs X-Received: by 2002:a17:903:2444:b0:1e3:d4a2:3882 with SMTP id l4-20020a170903244400b001e3d4a23882mr13589088pls.2.1712674039199; Tue, 09 Apr 2024 07:47:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712674039; cv=pass; d=google.com; s=arc-20160816; b=qlYSD836p2de/LHx5MfgGnDr0sUGMBNCQROUp8vGePm3o3V54oeRsmhUmeD3mNmmnL ZDEFrPSVDMmfwYjlTRA9gak6q6pW2SpQn1YZUmxKuPvNlQJIflAV3a+qEOKdPpQjDLG2 PX2qnTOxC8nBdyckqWpomD4FvLMv0uWJb2JrQS/8BQED8q7+DCkIC1mJvcm9D1mTIDif EDv+uS2rC9RrbPZxArb6JHCKTzggXBgF4vWO/w2hlC9/7EKtUSCiymsQIDc/wo+ECUV9 v/29BzX34C0aF31Z0tYVGseIAiyK4PEDrOH7PWsVWMMSGieKJC5N5X+3rMaRUkR5h4OC UYgg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=IBPxWFHl1AiWVB8UI+LeFpQ0i9dZV3ja6KQ3kYMVIr8=; fh=bZ8A7sq2EwoPeouFJfn9FzbSBYo/OpBv6peT3PHzdkI=; b=o1i7U2a7diV2xYoDFkUIx6mOYkpA7FcP8Z5XvcvVPzt5YlqUc4Epefiw/idg7iMll1 f3VZ3LtocyOEl2eLrsTZNNpOp53NCrlBE6+CR2uj6U8K+wVC6UZL8goS7i8mH3ObcUnx pujRIhO4qzcxN4FQKLuLggsS7LxS13cCsAxWVXomlloiFNyCAg5h1RygV+22ZMP1IgrB MtsSedqHtbS1V/qgKNfbKK82D1lp6+mvfkhChIiD2r9FCbCQiGDaTTFBcg/u+dfHJgfY /lKdgZ4KVsOOJfEhsJBjo6W+bviWKkxbpFFafNlcykuosYmpKooZS77ljN136zfsulWH ap8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OrcP0M3h; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-137109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137109-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id lq14-20020a170903144e00b001debbbba48dsi8790407plb.197.2024.04.09.07.47.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 07:47:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OrcP0M3h; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-137109-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137109-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 91212281F1D for ; Tue, 9 Apr 2024 14:44:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8D05130A4F; Tue, 9 Apr 2024 14:42:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OrcP0M3h" Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98B8312F5A3 for ; Tue, 9 Apr 2024 14:42:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712673723; cv=none; b=g5vwnsVqwH2gTOAcL4je9uAkmETJYn1OyNJw6eLHQOfF7zoQrbp7p9gc3aL4UZ60IaSDFBovJuvOOw4pFjjC4YSLAdQiJ19ktKgKJU1DLwc1V3kkNAdxIBq0yQBjW0Mazwsjl296JwJxu3yyRZeBCmMzDppedKI4kRR52bAEmXA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712673723; c=relaxed/simple; bh=HC00lmey8uySGF4Lqn7tzQE0xcyEUhYbAHGKCK5KpUo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=e1+5llrP74adwR9tybJtAorHXf0V5rxs8kfek/sLOgJ72Xvau28OV4sprH39JBAi4/b9p3IA6oMQ4EJMR10hLgDOo1jAvo3laXvCob9LMVXz6DDWjwFnfXCFRQVeFxy4SKH68VYpKFYjbcAcExLTasWHNDkQH8F+2GJtuhpQk7w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OrcP0M3h; arc=none smtp.client-ip=209.85.217.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-vs1-f50.google.com with SMTP id ada2fe7eead31-47a0bebeacaso721549137.0 for ; Tue, 09 Apr 2024 07:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712673720; x=1713278520; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IBPxWFHl1AiWVB8UI+LeFpQ0i9dZV3ja6KQ3kYMVIr8=; b=OrcP0M3hrVHMUHIU7aKw6E96OX5qd2osL/nYP1IIz9Du+yrGalPEq0XBILBGGDs1Go gcHpTpj3w2IVy680zeLygy3mLCpLJG1D/rgj/eNRX7wtbihH34XC3kkTJPMqKVl2TId7 JOfVeY5wboQvMaALS21atRQG7s7TvkSzQnf+JD4aOXlIMIcZQ1BCI8fmCUXgnRywCSzz pc/tny1MDgXpQpw1zWUZ6nakjTF2QDc4bvSKlpvoCd4KoC0mUb/Y6rxfMFagAy2KzXrs VhPlSlsIWd1KhAEc76rJfEEErHqUQ3bXBsj26nB3YXwWcRsybywUjC7msqegaWfzbEAx puJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712673720; x=1713278520; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IBPxWFHl1AiWVB8UI+LeFpQ0i9dZV3ja6KQ3kYMVIr8=; b=ZCzE2WF2z5Pljw0/EuHc5a38be7O/RjCo0BTaHzLWoCPfe2wRRfcC7TLFIQRHuPQQk p8fEzclvmzeSFFKTKm/S6aesj/SQp5Zdpq8XNPSJ1vsVk/lPk4syELuTsIYCb18BW1Lx cgcH+cNhKJkVp1kz07K+QNvBL3h9/fMvGDlLhVnQAbJHH98u0dfV4HllgHGotd8/veKs lcrAAyEVU6jVWJa8geq89SZ/OT7X6klk0q2tnDiWMXnUGIo2q6WehvAA/bInhLVGxwBU Fe7w98nULujUL15WEEdQwWLIy1B2opRWcQnjBJmz97f2mBqWll8EywZgyaHmChtLyhHY fYVQ== X-Gm-Message-State: AOJu0YyRbne/9tZoi9PvNlrHuWUYBMedUKgBli19fKa0LcHXK/bfdXgM iqC+Hv2GQNmWU86F2hgJwwIdBDvq0BzpbWiTIHvYlx8Wq/5ASlG4OVjmgvsMxGdlJ/LMgNW9Yh9 ksmXUH/5NYndoud2kF0KAw2/N0AY= X-Received: by 2002:a05:6102:6c7:b0:47a:1005:ca15 with SMTP id m7-20020a05610206c700b0047a1005ca15mr3911038vsg.16.1712673720180; Tue, 09 Apr 2024 07:42:00 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240404195254.556896-1-jaegeuk@kernel.org> In-Reply-To: <20240404195254.556896-1-jaegeuk@kernel.org> From: Daeho Jeong Date: Tue, 9 Apr 2024 07:41:47 -0700 Message-ID: Subject: Re: [f2fs-dev] [PATCH] f2fs: don't set RO when shutting down f2fs To: Jaegeuk Kim Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, =?UTF-8?B?TGlnaHQgSHNpZWggKOisneaYjueHiCk=?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 4, 2024 at 12:54=E2=80=AFPM Jaegeuk Kim wr= ote: > > Shutdown does not check the error of thaw_super due to readonly, which > causes a deadlock like below. > > f2fs_ioc_shutdown(F2FS_GOING_DOWN_FULLSYNC) issue_discard_thread > - bdev_freeze > - freeze_super > - f2fs_stop_checkpoint() > - f2fs_handle_critical_error - sb_start_write > - set RO - waiting > - bdev_thaw > - thaw_super_locked > - return -EINVAL, if sb_rdonly() > - f2fs_stop_discard_thread > -> wait for kthread_stop(discard_thread); > > Reported-by: "Light Hsieh (=E8=AC=9D=E6=98=8E=E7=87=88)" > Signed-off-by: Jaegeuk Kim > --- > fs/f2fs/super.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index df9765b41dac..ba6288e870c5 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -4135,9 +4135,16 @@ void f2fs_handle_critical_error(struct f2fs_sb_inf= o *sbi, unsigned char reason, > if (shutdown) > set_sbi_flag(sbi, SBI_IS_SHUTDOWN); > > - /* continue filesystem operators if errors=3Dcontinue */ > - if (continue_fs || f2fs_readonly(sb)) > + /* > + * Continue filesystem operators if errors=3Dcontinue. Should not= set > + * RO by shutdown, since RO bypasses thaw_super which can hang th= e > + * system. > + */ > + if (continue_fs || f2fs_readonly(sb) || > + reason =3D=3D STOP_CP_REASON_SHUTDOWN) { I think we can use "shutdown" variable instead of "reason =3D=3D STOP_CP_REASON_SHUTDOWN" to be concise. > + f2fs_warn(sbi, "Stopped filesystem due to readon: %d", re= ason); readon -> reason? > return; > + } > > f2fs_warn(sbi, "Remounting filesystem read-only"); > /* > -- > 2.44.0.478.gd926399ef9-goog > > > > _______________________________________________ > Linux-f2fs-devel mailing list > Linux-f2fs-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel