From mboxrd@z Thu Jan 1 00:00:00 1970 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 A1455149C50; Tue, 25 Jun 2024 09:38:35 +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=1719308315; cv=none; b=DL5HyezaWIJR8nTHVC4jimvVav5HOSOZn8dUyDvpmxxwe6a0vIZnqX4v+TG+CGcqRaHs49/VpvuPT7D9sGOZlEj7ONe9zlRrJkXqNRUzVa1rUMUbbh/wCCUk/VNsXLEhz4FefJmuQN36kifl9ZR4yQ/2QyvvydgvNbK81WmsCa4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719308315; c=relaxed/simple; bh=maja82EiY/W+cw8Z8rS2DlzgYvNnWDfvaDiNiYfdKms=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UjGPowYrkOuPzl2w0S4zNcDVbtxlqnRrQaMC9YiPh/ateASWJ4PdZQCjou9mSiA4MdAQ/jKJIwTGXISfxosS3sbyS0LB74oRgWA7a5uQhNSO5VlOHt7ShxoIY/rYAKG3de8PJnoVbwXAc62D+SAYfNUB+LuQebCxkqxz+4nbvwE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OTt+P+++; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="OTt+P+++" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2F7DC32781; Tue, 25 Jun 2024 09:38:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1719308315; bh=maja82EiY/W+cw8Z8rS2DlzgYvNnWDfvaDiNiYfdKms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OTt+P++++EE84kIFt3MaKphbpiFmPlaA44f3Sdf4hOJvxGyskODDyQley0AYqnko8 8NLcI3ZKWFrNBNj1VEWGFR9VTlv2Vj5MAiT8SeZH15QSlZNP5nEvYCXHBA7jFS5O+G vu+PXmYmWMUwxyPdRbbig7reFXtWeHBsrtjXPlno= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Light=20Hsieh=20 ?= , Daeho Jeong , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 6.9 080/250] f2fs: dont set RO when shutting down f2fs Date: Tue, 25 Jun 2024 11:30:38 +0200 Message-ID: <20240625085551.136000488@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240625085548.033507125@linuxfoundation.org> References: <20240625085548.033507125@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jaegeuk Kim [ Upstream commit 3bdb7f161697e2d5123b89fe1778ef17a44858e7 ] 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 (謝明燈)" Reviewed-by: Daeho Jeong Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/super.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index e4c795a711f0f..2f75a7dfc311d 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4129,9 +4129,15 @@ void f2fs_handle_critical_error(struct f2fs_sb_info *sbi, unsigned char reason, if (shutdown) set_sbi_flag(sbi, SBI_IS_SHUTDOWN); - /* continue filesystem operators if errors=continue */ - if (continue_fs || f2fs_readonly(sb)) + /* + * Continue filesystem operators if errors=continue. Should not set + * RO by shutdown, since RO bypasses thaw_super which can hang the + * system. + */ + if (continue_fs || f2fs_readonly(sb) || shutdown) { + f2fs_warn(sbi, "Stopped filesystem due to reason: %d", reason); return; + } f2fs_warn(sbi, "Remounting filesystem read-only"); /* -- 2.43.0