From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A74B4C6FD18 for ; Tue, 25 Apr 2023 13:23:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 292F06B0071; Tue, 25 Apr 2023 09:23:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2437B6B0072; Tue, 25 Apr 2023 09:23:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 10B2F6B0075; Tue, 25 Apr 2023 09:23:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F06E76B0071 for ; Tue, 25 Apr 2023 09:23:19 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B87EF12010C for ; Tue, 25 Apr 2023 13:23:19 +0000 (UTC) X-FDA: 80719979718.19.6A09266 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf21.hostedemail.com (Postfix) with ESMTP id A7DA31C001D for ; Tue, 25 Apr 2023 13:23:17 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=H5RfPmr5; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=3CbBzZyW; spf=pass (imf21.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682428997; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=q2T/Y7qFdCUy3re4ctXa9sRrn9+mZ7IugqZ9aq6o34k=; b=ZGMWakNGg1BXL0koO4N2pjxpb1kORy/qXfDt8lH+MOHYJS42F7bzUM9zC6k73fg6IX2y2/ lz4K+xqnoVZsZK14AeFYNvU+kKC2llADRnu6ixkeg2Fs3bt3q3dhFQiwMmEyAYvryIGH/q DvCKyQRiePnvjrRs1MAq5g47hmthCYM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682428997; a=rsa-sha256; cv=none; b=FRAn1FlkQV2OrfMGANQw4x4hveTjz2Pht2qEdnnNaqRaS3TcQMsAyb795/9kaDOcC9kyuD MBV4zSyMiTnDBB56FQN5qEHdDDNt/fJrYs4A+Z5gO9ijEL28P42OLtagiKWQ4vzwRpDsx4 mdurb1+RVF1n9fJI52NyA/Hth3HLDX8= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=H5RfPmr5; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=3CbBzZyW; spf=pass (imf21.hostedemail.com: domain of jack@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 74FB91FD9D; Tue, 25 Apr 2023 13:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1682428996; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q2T/Y7qFdCUy3re4ctXa9sRrn9+mZ7IugqZ9aq6o34k=; b=H5RfPmr5xbyO42qx+ZpGkRUj4c5qyh3489DrJZCn0bCZCHarr9ITUocACe2p9hpNO4DjSS I3z5Mo9Scj2JMheTyoFt4x5R1/Qn79qJ3eUzSMfYiOmEpEXjQi1GRNYfGXNs0dZcIA1kSj Z6PSBP3KAuGFl2cD/TbSR4YODdQbzwc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1682428996; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q2T/Y7qFdCUy3re4ctXa9sRrn9+mZ7IugqZ9aq6o34k=; b=3CbBzZyWb+srmnqcSy2+VdX9IAWZmiyyj1hNABq5DBj/WsGr2Y+J12K9Mqh+LOIqmTzs3m dRxsR5GpIV4WdPBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6633713466; Tue, 25 Apr 2023 13:23:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Jw3kGETUR2S8EwAAMHmgww (envelope-from ); Tue, 25 Apr 2023 13:23:16 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id EE3D9A0729; Tue, 25 Apr 2023 15:23:15 +0200 (CEST) Date: Tue, 25 Apr 2023 15:23:15 +0200 From: Jan Kara To: Shiyang Ruan Cc: Jan Kara , djwong@kernel.org, Luis Chamberlain , linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-xfs@vger.kernel.org, linux-mm@kvack.org, dan.j.williams@intel.com, willy@infradead.org, akpm@linux-foundation.org Subject: Re: [RFC PATCH v11.1 2/2] mm, pmem, xfs: Introduce MF_MEM_REMOVE for unbind Message-ID: <20230425132315.u5ocvbneeqzzbifl@quack3> References: <1679996506-2-3-git-send-email-ruansy.fnst@fujitsu.com> <1681296735-2-1-git-send-email-ruansy.fnst@fujitsu.com> <0a53ee26-5771-0808-ccdc-d1739c9dacac@fujitsu.com> <20230420120956.cdxcwojckiw36kfg@quack3> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspam-User: X-Rspamd-Queue-Id: A7DA31C001D X-Rspamd-Server: rspam09 X-Stat-Signature: ha9cpxtt5rj4ikgxhh35r1wtaz5wjc9j X-HE-Tag: 1682428997-78393 X-HE-Meta: U2FsdGVkX188bHKXeM+tMsTKREpSlKPUsJWpC/aicrN8y8ogjTzAgJGS3KhpyRvwcGLGRXmHkIpeiwsNbJvYZXbpadTk/na0J5GHwInW+wk/74PwlfD9X1PHEj167958ZOOckAuHXB4MzsyA1oamc7fAc9Xlq6zH890+ONc8cxKDV/fEv5iTjS34YoxZvSv6AXFoMCxEdUrcfrrCJ2NR/v+KxD+aN0DzOiO+iVm4u8QIR94vkvzvyPLnxZ60NNVnQV7Rv1AhR8Ut0Uo3EmJXsMYdPm4elqSCTRl01ZGV8EBuA3w+zoEHK7coAx5xIC3kfA94hqq6HUIjGMyFUW6xpeDFQ7vzELJdQjyvtGwydsypnogYXe7K2ylZ9fpKUMpUOlAJlcC8vGd/ahr7tmE0NqtZmDahVDeoE21ekqvpVFjjD4ymrUlFe97udKLT2EyJaepLzRSAl5smrZr/cyS2MEABzlRluT43/bUQ2TYSu/YF8rgzcYHBqv8j2KMmCKqmLsObj5p4vKUYbi+TYCbcXJWwhVR+IbLqpttmdmzZZ4+IYyDierj2GEjK0FNtikkzVPvjnv/byeofUEYHUroLDQz2cTi7Vwv00E2k/wnsrXwT1QqgRgmFKrJSI4eSTVSNgHo5dBYkGPepMGvDQSyksqwhUTxr5GAc8Zrk/bXg9P2gGVxQZNJ5NoCjbsGfj2lywLdbyRJB7XOzSZahLMduWNG4Nry0anqepKO8Mx+TJrYyItcsVRd9+Owmip2XIpqVXoBP7jez8TZ4Agd1I5vEeTmQhgH/gP7GkQXK/hBhkSJ6IyGF4EbdK92A7yh7uea0rwQGrzHRv4R8KINw17skWIqXpTA3BxfNz+Pqnm/1duI2Nmg2ERjdssmUHb9mgI9QlTcg/sqyjZZbnfoLUzhbD0sEhWr6OBhlLaziAmJiIlGMk/TPSpCQm0qev1nyMgT+7zwibxTIyU+ycgiZ6uq 84WslB3U OYwWJbhuRz0kSNqfkbUr7CjNZUmCkkYg4x8OQaVsHqSm0dABsndlJXkdd2UM0kink3yDDHgdpTVsqJJ0kB2Yj0fy6EjxorcX5mR0PaLzfXGZ8yjPexLxp1s6izTy+bzWCBOxSjqtJlrFmskeyp35ZXmGXXpEUrkf615HV0vROyEGr9DZP+FZB37ee9VR0BrMhNxd/ToQClcr+VQ4JMw6AjziTynHgaDQxxso47hRg4/+6wQRlhbvd4y1bO8gLHkuF8AjVBHEacoV7bAcE5IEjXa/gKRFXnFyaLrGoFV/sW4taF5/fpEQcE/vS6efFUoltvxKQb1Ny/6LqPtBhOv2GhgQWoO/X3I4NARtaHm1TB877dpk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000020, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue 25-04-23 20:47:35, Shiyang Ruan wrote: > > > 在 2023/4/20 20:09, Jan Kara 写道: > > On Thu 20-04-23 10:07:39, Shiyang Ruan wrote: > > > 在 2023/4/12 18:52, Shiyang Ruan 写道: > > > > This is a RFC HOTFIX. > > > > > > > > This hotfix adds a exclusive forzen state to make sure any others won't > > > > thaw the fs during xfs_dax_notify_failure(): > > > > > > > > #define SB_FREEZE_EXCLUSIVE (SB_FREEZE_COMPLETE + 2) > > > > Using +2 here is because Darrick's patch[0] is using +1. So, should we > > > > make these definitions global? > > > > > > > > Another thing I can't make up my mind is: when another freezer has freeze > > > > the fs, should we wait unitl it finish, or print a warning in dmesg and > > > > return -EBUSY? > > > > > > > > Since there are at least 2 places needs exclusive forzen state, I think > > > > we can refactor helper functions of freeze/thaw for them. e.g. > > > > int freeze_super_exclusive(struct super_block *sb, int frozen); > > > > int thaw_super_exclusive(struct super_block *sb, int frozen); > > > > > > > > [0] https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?h=repair-fscounters&id=c3a0d1de4d54ffb565dbc7092dfe1fb851940669 > > > > I'm OK with the idea of new freeze state that does not allow userspace to > > thaw the filesystem. But I don't really like the guts of filesystem > > freezing being replicated inside XFS. It is bad enough that they are > > replicated in [0], replicating them *once more* in another XFS file shows > > we are definitely doing something wrong. And Luis will need yet another > > incantation of the exlusive freeze for suspend-to-disk. So please guys get > > together and reorganize the generic freezing code so that it supports > > exclusive freeze (for in-kernel users) and works for your usecases instead > > of replicating it inside XFS... > > I agree that too much replicating code is not good. It's necessary to > create a generic exclusive freeze/thaw for all users. But for me, I don't > have the confidence to do it well, because it requires good design and code > changes will involve other filesystems. It's diffcult. > > However, I hope to be able to make progress on this unbind feature. Thus, I > tend to refactor a common helper function for xfs first, and update the code > later when the generic freeze is done. I think Darrick was thinking about working on a proper generic interface. So please coordinate with him. Honza -- Jan Kara SUSE Labs, CR