Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2139839pxm; Fri, 4 Mar 2022 10:05:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4CUT2328W9vkJ2GiU1CbY8DSdF7M0Ex6tXP1JhxHpT71x025jv9HekC/Ia9UuimzyDDs1 X-Received: by 2002:a50:8708:0:b0:416:765:c4c4 with SMTP id i8-20020a508708000000b004160765c4c4mr2947659edb.245.1646417158146; Fri, 04 Mar 2022 10:05:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646417158; cv=none; d=google.com; s=arc-20160816; b=H+3chzvMmGhCcE/sNDiC+t6sq6KVpr0TSq+SI5shkGD1gKFAAtNuwDXcD/JQbIvSRA QCa3B6pWP54lvFb5w6SAwPVLBGM9c7uFzsIVJBR2wTOJZJq5atU8v7yPcFVLG1/D+Ikq 0W99Yv8VfqTd+m+dIJHvzIcSqRSLDzUDHqOOxTy3Zyzg93sGq7P+muVxcl75bUdG69vZ VFrQJyh10DTKdrPiyQNmHxIvDRheaLWDFzufVJg1xUZesSk71uiXk7mGauoEHuXm4XTC UVDk43f2c6Jjcc8oerU0GYdcj/ydx1KceiZbKPcvY4DjyzNNDwu0wfmzJMskaLdrJk7I 0IUA== 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=dXZo/9GDlcfGx9fA7RVAOG+V1Lnl22SWJTOxOOkwaQM=; b=QuQzrdw91BcAO3cgYl9RDFA7yUdXm+qIwT54b+sg9E/KgHnIX+xo+LZRdwEq1Dp3WO 2/9HddkV9yP/244BMVD2//ZPlOBymc3Ug0YulhAwH+PuqYPSue4pa2tQ0I2jfXzmE5jW G7L04qaXFfUl+rtbQKI73CHlQEyhVEYc4frkLaxRcpykUh2Z5UuII10WsSUvemuenGND Z5W9l7cKb4JFwy0irJI8iWYo9aGCSoxEM1fSVt985+ZOfxix/Ud8kRLt8UPyWWdw8wHB oUr4pqEYoFO62VKUybZBe5hrirjl3erOTqDrsRTN7VEix94RSn6zNa+gws3CNmfGu2EI hQMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sKidgxBu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga35-20020a1709070c2300b006daad41b1b3si2094503ejc.168.2022.03.04.10.05.33; Fri, 04 Mar 2022 10:05:58 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sKidgxBu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237993AbiCDFPl (ORCPT + 99 others); Fri, 4 Mar 2022 00:15:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230244AbiCDFPj (ORCPT ); Fri, 4 Mar 2022 00:15:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C42E793A2; Thu, 3 Mar 2022 21:14:53 -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 B9B0661B51; Fri, 4 Mar 2022 05:14:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B8F4C340E9; Fri, 4 Mar 2022 05:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646370892; bh=ODU2AzuMqeCYdLnYB8MUUu6xqoN8AmqM383XcKtwS3E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sKidgxBuYTJtU+NFI88zD5utn/8x4AjSa/T8H+Ywpy1UrrQWRG2S8dF5lVHi3Pso0 P1N/tPC+cp9YUqrQO7NBC0Us5Px+bO5i+bNPooAa72r0QarAI7Im0AHRvzfqNQeoGZ 45qMP/AcW9XsiEfBr6EFyE+UuSs05yQP+Tn233f124AfXsrno3tJ7oC/UTfopKtVUU 9+70THeWVaMQxSkff2/XA4JPxmLsBZfPlb9rA9yENE+e6hf36xQiKgsVT4YA6Wwqde OIJA1vjhSn+8mYiNZ6aHLpC5geRTI8dj4cD1VgCnIKE+RuCi5ts4rX6mOKodONkVp/ MA7Dx1fqTWsCw== Date: Thu, 3 Mar 2022 21:14:50 -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: <20220304024843.GK3927073@dread.disaster.area> X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 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? > > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com