Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2189718pxm; Fri, 4 Mar 2022 11:02:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxp1AHVX7FXjgR+gjy4jQWr24wGdG6k3bXhmoFotqMOCYN+5YQ9pGd63BXNrFcgGuh39z9 X-Received: by 2002:a17:90b:1e4b:b0:1bd:4c83:56a7 with SMTP id pi11-20020a17090b1e4b00b001bd4c8356a7mr12235011pjb.109.1646420537234; Fri, 04 Mar 2022 11:02:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646420537; cv=none; d=google.com; s=arc-20160816; b=IYP4KHaGpDCl9YwYLuY1ldpGSBafnaxjXtG+R1qsV5eeFEt4xqGXX9ZYy16UHQ85dJ lECloPZEuNj3GYy2ScPAlswGnjuz3yyS6Fa5JFnUDI1/TNjGj2MMElApFpIzAx5WFe0K jFpx71ILK7dTHQNBhbONuITjdbaPcGhk5KpN5titwK1Sw+wBg2ThCAACBOVxA3ktBqES 8ss2Ff/7KqGKww+VyWsymzsx0WizV4kXK2y1qjnCz+cELHTT0kNwvD+C6SN3KRBTvEUY a4W/CEeho+jMK+ooZ1glkSSwZ7Uh4Bj/rnVVXQubm5aNuRsqILrt3xF/fPiD0Jv7gvNr B2qg== 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:dkim-signature; bh=JI+JyCYKc37wmkFcHY63s/o9AKawmCjO8pQxURHWj9s=; b=OD+XksJNKpnE1dzPX/Fh/As9sKeHZJ5Qgj1quPCeFQ8Z/o6Op+SAf5ThRLBSdnEUCY WcM090SwGDITtw3pyPyiMPoV3NbBIdAGOYQVqDWGrYoIvnw9Z7TVofcagNiYtkH+zAMp Lc3WlH5h9m8Diwc9yiJxawULUkNEoxlhwuEz4SFElA5ZcT82GeA1AI897z7PYQ33tLEJ I96HMrPADfdY4JJz0tp2LYk07NlBRrDDxMozZ5bsE/4vh+IfqlPfMihwwZCVzXQe/t+t FAmhqA15TnkXeAuknGe7h05VvdpAdQEpq5JhkTiCWUPXI+HmEusAcWhIofgFA2Hv8xTE WlXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VfNnOKYk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i23-20020a635417000000b00342b1567fd9si5207766pgb.238.2022.03.04.11.02.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 11:02:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VfNnOKYk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7899C1DB3E0; Fri, 4 Mar 2022 11:00:57 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241504AbiCDSFc (ORCPT + 99 others); Fri, 4 Mar 2022 13:05:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241495AbiCDSF0 (ORCPT ); Fri, 4 Mar 2022 13:05:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F3B13B002; Fri, 4 Mar 2022 10:04:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ACC1C60C77; Fri, 4 Mar 2022 18:04:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 033D5C340EF; Fri, 4 Mar 2022 18:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646417077; bh=425WNeNRrB56ZehLPxE5ZW7E9I6KVwqgV1Gf1LwYGgU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VfNnOKYkOxwckoxihS5Rta454esEJDsTkWgg9wJWLJVLhOVDynvrbtVzlU0YBZov/ zGz8K9qJr4ix5z++KXTQPeRFY/+AK03Ks++ginvyjzH+j2IenDsU7WcTnMqE3s3MSw CMbhtzkgi+YrcJ2X28HyeMO0/HIQuTPSpRu8f/hjsFvHA5TkNtoNpR6lSSznJEShXo /WfW3wFIoBXrpAGRZFYuNm7T9lKowvITbuWjBH56Porp703MrASmRKLxx65wUOrdRl aDEV7eNzX3SZGv41egNvXofXb/gMQ9pQuLyPSp01QXmalMUlbiMO+Xc/7dzjfgrzhx jXsOtehfpCZjg== Date: Fri, 4 Mar 2022 10:04:35 -0800 From: Jaegeuk Kim To: Dave Chinner 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: References: <20220304022104.2525009-1-jaegeuk@kernel.org> <20220304024843.GK3927073@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 03/03, Jaegeuk Kim wrote: > On 03/04, Dave Chinner wrote: > > 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? > > Ok, that makes sense. > > > > > > > > > [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. > > If so, is this a bug in drop_caches_sysctl_handler? Or, I shouldn't have > used "echo 3 > sysfs/drop_caches" with freezefs in xfstests? My bad. I totally misunderstood. I'm testing a patch to call evict_inodes() in f2fs_freeze(). Thank you for the comment. :) > > > > > Cheers, > > > > Dave. > > -- > > Dave Chinner > > david@fromorbit.com