Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1530277pxm; Thu, 3 Mar 2022 20:58:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGgrAIGJu5neYt7jecFFeQN6uDEWFk7HB/FgeJp6i8Jpm2jeOIcePXXA55ho3rLPYW0JYU X-Received: by 2002:a65:5bc3:0:b0:378:4f82:d73d with SMTP id o3-20020a655bc3000000b003784f82d73dmr27445481pgr.191.1646369926320; Thu, 03 Mar 2022 20:58:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646369926; cv=none; d=google.com; s=arc-20160816; b=OzIfXXHEXwHP9xKYdMuv28eCVG8ozltUBKhuzIhUZFO9gcul3/QqZzDTC/dscY+ZYc 0z7WGkAOBTlQZ5wGicm02B2r2/9k+QXup0oQwHTYcEVMeIbMCW/SNgvNXsmE51HtNo8o mwMPAsIdkPWCOhC5phe5Yv7Z480/+GMPZxdAG09F7TKC75t+2puzPcUdQPdJTeCwhGJZ 5RI/e1L3mefdbJOkte0cApLEzQ8TNeSynhDDP6wvlODYB0bi6MJ9UKmURX2IDhnXCaRO sbeNrFSLe+DU+XFfEKvtLLxJjZOOnxT5axTV8PCUpplGShR7v3982Rx+syaxoWUqPwHI BuzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Eifyexz9y9uxdA28NVTouwZJ09Vg1XcmAlGAlQYzhAo=; b=RRZObkznADGkne6CGVl0OxJhKqYGi6hwSD8PsLreqn/9eHndu4mV6fBXLRSIKt++h/ PETTJLL5FDBKLvJnywpvdoSuca0ish75lDJqQ/Ya7D0AftnvAP35kIjOZnNfzHZ/PYXX 2DTF55J2fh4zGA9pcv4CWarz5HvKfjElJ1MqN3Qinn7X0l6QeUn8HhDqJsM7qsJ7o+4A bAbqqQuJtWXAoajE9il8x0VRn5RHgrQ2ONHNyY3umB2D5rROYuKVmtLn9zrxFCZQwZtu 3tSsnU9kDtHUT6FL/HCRcKb5RcCRdYy6OlurFJBezck0OdR3djx/qCqavBRoa3XqJ0sE wXQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s14-20020a170902ea0e00b001516fc9d361si4137410plg.606.2022.03.03.20.58.28; Thu, 03 Mar 2022 20:58:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237769AbiCDCti (ORCPT + 99 others); Thu, 3 Mar 2022 21:49:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237762AbiCDCth (ORCPT ); Thu, 3 Mar 2022 21:49:37 -0500 Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2936617E368; Thu, 3 Mar 2022 18:48:47 -0800 (PST) Received: from dread.disaster.area (pa49-186-17-0.pa.vic.optusnet.com.au [49.186.17.0]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 22A845303F6; Fri, 4 Mar 2022 13:48:46 +1100 (AEDT) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1nPxzn-001G5M-KT; Fri, 04 Mar 2022 13:48:43 +1100 Date: Fri, 4 Mar 2022 13:48:43 +1100 From: Dave Chinner To: Jaegeuk Kim Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] vfs: do not try to evict inode when super is frozen Message-ID: <20220304024843.GK3927073@dread.disaster.area> References: <20220304022104.2525009-1-jaegeuk@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220304022104.2525009-1-jaegeuk@kernel.org> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.4 cv=VuxAv86n c=1 sm=1 tr=0 ts=62217e0e a=+dVDrTVfsjPpH/ci3UuFng==:117 a=+dVDrTVfsjPpH/ci3UuFng==:17 a=FCBBoiUPZGnDA3Uh:21 a=kj9zAlcOel0A:10 a=o8Y5sQTvuykA:10 a=7-415B0cAAAA:8 a=f26EzWiRBdu2aCluGM4A:9 a=CjuIK1q_8ugA:10 a=ZXjPKerQ9QDAtgzuyCT9:22 a=biEYGPWJfzWAr4FL6Ov7:22 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 03, 2022 at 06:21:04PM -0800, Jaegeuk Kim wrote: > Otherwise, we will get a deadlock. NACK. We have to be able to evict clean inodes from memory on frozen inodes because we can still instantiate inodes while the filesytem is frozen. e.g. there's a find running when the filesystem is frozen. What happens if we can't evict clean cached inodes from memory when we run out of memory trying to instantiate new inodes? > > [freeze test] shrinkder > freeze_super > - pwercpu_down_write(SB_FREEZE_FS) > - super_cache_scan > - down_read(&sb->s_umount) > - prune_icache_sb > - dispose_list > - evict > - f2fs_evict_inode > thaw_super > - down_write(&sb->s_umount); > - __percpu_down_read(SB_FREEZE_FS) That seems like a f2fs bug, not a generic problem. Filesystems already have to handle stuff like this if an unlinked file is closed while the fs is frozen - we have to handle inode eviction needing to modify the file, and different filesystems handle this differently. Most filesystems simply block in ->evict_inode in this case, but this never occurs from the shrinker context. IOWs, the shrinker should never be evicting inodes that require the filesystem to immediately block on frozen filesystems. If you have such inodes in cache at the time the filesystem is frozen, then they should be purged from the cache as part of the freeze process so the shrinker won't ever find inodes that it could deadlock on. Cheers, Dave. -- Dave Chinner david@fromorbit.com