Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1058515lqp; Fri, 22 Mar 2024 04:34:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVKm8RdaU+/42RIVUH6FaUhy5yYpYgwY12ua0V8bfGnvmDwIJyt8QTPTge+70RkLRylLjyqkrf7hAJP2YQh84+P3D5HxF4wDp1au+uZBA== X-Google-Smtp-Source: AGHT+IH19f/W03LStrqqjNFc0Z3ph/RQWA35JebvrZKkP0dO2RbDa7Oln2S4zIwLoPdFZw/B5d5l X-Received: by 2002:a05:6870:960d:b0:21e:7751:312c with SMTP id d13-20020a056870960d00b0021e7751312cmr2042332oaq.30.1711107281472; Fri, 22 Mar 2024 04:34:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711107281; cv=pass; d=google.com; s=arc-20160816; b=m4qTEkt78zJoLfiCba6lQ/f7RWsZAtqUTbsr5DnKF4YTWUPVwTYvuRSbRedGzoIYQd 6MlF7T/whaeQSE6e0FIuLXlLEV6ADXl3ffzEqCHn3csZf8iG9BxqjaM6TC2Ps7qZiCU9 o51sLB3rs8wfcHkSt4kBzfNvWBRz9ExHjuBRa5arb3tQI6aNlyFYzROyQzMsRyH1KLo2 EqVJaleX/5A9xfJwqNthkjwcJzrEgHu5niM0/TfNeCGjxWhm/wFuaiBiaRpBTm42+hz3 QhFN9bTqj+fweNb7lJIzV6ymC0jlmVazQ9C/4aFaRWTGUBsYlZu2gzqKFfq+YyPmmTBp ymmg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=G9B+ZGUSZ+2S6Q6yezY78Wg3Rs7d3EQ0T352gGNsEiY=; fh=LOaFicR3mEkwGCQ73KsqHFWrljpyESdTi1JbOEaFWDs=; b=YeYY2KckcDKQ9w6wzvwfuyjhzc1vO9+lqU6MJ7F4Dpy5k7OFfIqeMGYsHW7uIYaCpv 6uTCyaO94HiipfJ41iHAKv2YWSIgd+g8E2SaWbboUhzURi7crsVDXKB3GHIMv3FeqczT flfaae0cLNOK6cwrd8XvtsCXn4qkLgWL4d4p418vinVCAgCdGebfkYI7yJanZsrp/L9l nH/EGYbQRTOl1sRO6ipmDND6QolOFzOh3og7nSvHeqFE+ROeYaMWoVlvOILs8O4Oudx+ H75mHoP/2mXx29Eqxu/xfJPHMDdEaJol3t68Vrdb4TbynfzvoEzWa20ObGsHjlEQsQ68 uiYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-111370-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111370-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id c65-20020a633544000000b005e83f47f2fdsi1862982pga.256.2024.03.22.04.34.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 04:34:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111370-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; arc=pass (i=1 spf=pass spfdomain=sina.com); spf=pass (google.com: domain of linux-kernel+bounces-111370-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111370-linux.lists.archive=gmail.com@vger.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 21AD428440B for ; Fri, 22 Mar 2024 11:34:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6EB643FB29; Fri, 22 Mar 2024 11:34:28 +0000 (UTC) Received: from mail115-100.sinamail.sina.com.cn (mail115-100.sinamail.sina.com.cn [218.30.115.100]) (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 72F8D3F8E2 for ; Fri, 22 Mar 2024 11:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=218.30.115.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711107268; cv=none; b=OlblUsaHE4RSPkR5pjiP69LhgESM8/ONXbJ61uw4r7Iys//qRNA7YGfWetWLa+tpucUmLTHB74Mdnhv7PV9BCQtnFHx715Ml15X7UOrFAeXnSgU3n5lY7K1yj4pG4fRI3DzccBld4fc2wzQmZmXYpuWL7yt3d8Fi6+3UA0B967o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711107268; c=relaxed/simple; bh=ACSUIa5eILVdV9/unH/3mAmu4AhoNpcnkH7YwBEVNng=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XcZmsmGk0B5qR7qj8NdsvcKzvs7wQIdCaGqYbEdBESaoqe2sLdD17WzYNJzdBpRFCH1BQE9QVKU7l2OLQ47vEidNVaidKBmnvfi0FkHCTfGKPW9OU1Se/JOx7kse7hm82+Upp3lmLrcdQkVv4qRhUIcBRhnl3z+K2NDSdtuVeqI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=218.30.115.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([113.118.69.35]) by sina.com (172.16.235.24) with ESMTP id 65FD6CAE000022C4; Fri, 22 Mar 2024 19:34:13 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 49593745089255 X-SMAIL-UIID: 836C24187C8B403DA6AFA1FE929A0CF9-20240322-193413-1 From: Hillf Danton To: Jaegeuk Kim Cc: linux-kernel@vger.kernel.org, Light Hsieh =?utf-8?B?KOisneaYjueHiCk=?= , linux-f2fs-devel@lists.sourceforge.net Subject: Re: [PATCH] f2fs: avoid the deadlock case when stopping discard thread Date: Fri, 22 Mar 2024 19:33:57 +0800 Message-Id: <20240322113357.2599-1-hdanton@sina.com> In-Reply-To: References: <20240320001442.497813-1-jaegeuk@kernel.org> <20240321224233.2541-1-hdanton@sina.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Thu, 21 Mar 2024 17:29:03 -0700 Jaegeuk Kim > > I posted this patch before Light reported. Yeah, his report's timestamp is 2024-03-20 6:59, nearly 7 hours later, which shows that you constructed the deadlock with nothing to do with his report. > > And, in the report, I didn't get this: > > f2fs_ioc_shutdown() --> freeze_bdev() --> freeze_super() --> sb_wait_write(sb, SB_FREEZE_FS) --> ... ->percpu_down_write(). > > because f2fs_ioc_shutdown() calls f2fs_stop_discard_thread() after thaw_bdev() > like this order. > > -> freeze_bdev() > -> thaw_bdev() > -> f2fs_stop_discard_thread() > > Am I missing something? Light, could you specify to help Jaegeuk understand the deadlock you reported?