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 56E41C352A1 for ; Tue, 6 Dec 2022 10:52:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B00B8E0002; Tue, 6 Dec 2022 05:52:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 960AA8E0001; Tue, 6 Dec 2022 05:52:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 828AE8E0002; Tue, 6 Dec 2022 05:52:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7494D8E0001 for ; Tue, 6 Dec 2022 05:52:28 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4CEE8C0D06 for ; Tue, 6 Dec 2022 10:52:28 +0000 (UTC) X-FDA: 80211567576.11.B27D51B Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf24.hostedemail.com (Postfix) with ESMTP id AB8ED18000D for ; Tue, 6 Dec 2022 10:52:27 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=uPsblBSe; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="lsYXJ/g7"; spf=pass (imf24.hostedemail.com: domain of jack@suse.cz designates 195.135.220.28 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=1670323948; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5sN7XonIHkZPSXUeTVwCYriJf0V+92fbh96cz906ZH4=; b=58ZXPeDzlqbTeb3aElQQnlctfgeYFWx0FMYGd9LT72q+XuJ4fJ/1DO2HCxAmrsr893aesZ 3YSHLwtIfrzixdkgfhiShVawQuDPRRsI22lR23RxoYzU5eYiczEdvepMv9/xrXnQVzMTCu uSXnii2WEFZpbVPDPbL57aEXal7nMLA= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=uPsblBSe; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="lsYXJ/g7"; spf=pass (imf24.hostedemail.com: domain of jack@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=jack@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670323948; a=rsa-sha256; cv=none; b=oSwc6F3IyOIKCvc5qZsRgvxI4a5FUWuc+Z+Wx3ILiHB6sBTrRRBncj2CEA5We7eT97XSsO LM+c2k0miUZtaPE0qKrVNe/Vw1wrG7FxRma+/VTisLT8wGETqjEhMygixoDa4Re8vmbjgB /kcSvTtnkbvSH04E84EznKfNz/lXk8Q= Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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-out1.suse.de (Postfix) with ESMTPS id 2DD1F21C04; Tue, 6 Dec 2022 10:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1670323946; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5sN7XonIHkZPSXUeTVwCYriJf0V+92fbh96cz906ZH4=; b=uPsblBSeKAv+4PgDdzYGGUxaLa3iJiToTW1v5I7XvrGIricIScMgO0IfHI571XowaO1g2g fwwq80XRMZw5ECqXaDOmtfvwNkoAGo7LitzouOm54l2IN6rjkgMTg/0u4gVcUjHSWYT29b WUI76kJrGk1UUY2vLlrcMC5qbIO4AW4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1670323946; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5sN7XonIHkZPSXUeTVwCYriJf0V+92fbh96cz906ZH4=; b=lsYXJ/g7oh+PRG91le+UUGJ4ds/kwFFkMnhsdfvpBY6GUl95iiPlHQaI3MrH/oLnS33pSA GwjuUHIC9U3yniDQ== Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (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 imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 1F8EF132F3; Tue, 6 Dec 2022 10:52:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id +TivB+oej2O/NwAAGKfGzw (envelope-from ); Tue, 06 Dec 2022 10:52:26 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 583C2A0725; Tue, 6 Dec 2022 11:52:25 +0100 (CET) Date: Tue, 6 Dec 2022 11:52:25 +0100 From: Jan Kara To: Theodore Ts'o Cc: Jan Kara , linux-ext4@vger.kernel.org, Christoph Hellwig , "Ritesh Harjani (IBM)" , Christoph Hellwig , Matthew Wilcox , linux-mm@kvack.org Subject: Re: [PATCH v3 11/12] ext4: Stop providing .writepage hook Message-ID: <20221206105225.nr734teqlkueqdph@quack3> References: <20221205122604.25994-1-jack@suse.cz> <20221205122928.21959-11-jack@suse.cz> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="ctkz3xut3vy6qate" Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: AB8ED18000D X-Rspam-User: X-Stat-Signature: kw6d985hq1nb371ibduid661pwtdoug5 X-Spamd-Result: default: False [-1.16 / 9.00]; BAYES_HAM(-2.76)[90.76%]; SUSPICIOUS_RECIPS(1.50)[]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; R_SPF_ALLOW(-0.20)[+ip4:195.135.220.0/24]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; TAGGED_RCPT(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; RCPT_COUNT_SEVEN(0.00)[8]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_TRACE(0.00)[suse.cz:+]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; HAS_ATTACHMENT(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DMARC_NA(0.00)[suse.cz]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-HE-Tag: 1670323947-664592 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: --ctkz3xut3vy6qate Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon 05-12-22 22:17:26, Theodore Ts'o wrote: > On Mon, Dec 05, 2022 at 01:29:25PM +0100, Jan Kara wrote: > > Now we don't need .writepage hook for anything anymore. Reclaim is fine > > with relying on .writepages to clean pages and we often couldn't do much > > from the .writepage callback anyway. We only need to provide > > .migrate_folio callback for the ext4_journalled_aops - let's use > > buffer_migrate_page_norefs() there so that buffers cannot be modified > ^^^^^^^^^^^^^^^^^^^^^^^^^^ this should be buffer_migrate_folio_norefs, no? > > under jdb2's hands. > > > > Reviewed-by: Christoph Hellwig > > Signed-off-by: Jan Kara > > Could you clarify in the commit how critical it is to use the > _norefs() variant? It's not entirely clear what you mean by "let's > use...". I think what is meant is that we need to use ..._noref() or > we can get in trouble if while the page update is getting committed, > there is an attempted to migrate the folio containing the page. Exacly. For example when commit code does writeout of transaction buffers in jbd2_journal_write_metadata_buffer(), we don't hold page lock or have page writeback bit set or have buffer locked. So page migration code would go and happily migrate the page elsewhere while the copy is running thus corrupting data. I've added this to the changelog. > buffer_migrate_folio_norefs() is currently not exported (although > buffer_migrate_folio is). So if we need it for ext4, we're going to > have to EXPORT_SYMBOL buffer_migrate_folio_norefs. > > Any objections from the mm folks? I don't expect any objection. The only reason we didn't export that function when I've added it was that only blkdev code was using it and that cannot be compiled as a module. Should I send a patch to I've added a patch to the series to export this function. It is attached. I can also repost the whole series if these are the only changes that block the inclusion. Honza -- Jan Kara SUSE Labs, CR --ctkz3xut3vy6qate Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="0001-mm-Export-buffer_migrate_folio_norefs.patch" >From 69eb9d34de54862f8653a3c2ca4f96891e69f64b Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 6 Dec 2022 11:42:29 +0100 Subject: [PATCH] mm: Export buffer_migrate_folio_norefs() Ext4 needs this function to allow safe migration for journalled data pages. Signed-off-by: Jan Kara --- mm/migrate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/migrate.c b/mm/migrate.c index dff333593a8a..f00f5f6607b2 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -820,6 +820,7 @@ int buffer_migrate_folio_norefs(struct address_space *mapping, { return __buffer_migrate_folio(mapping, dst, src, mode, true); } +EXPORT_SYMBOL(buffer_migrate_folio_norefs); #endif int filemap_migrate_folio(struct address_space *mapping, -- 2.35.3 --ctkz3xut3vy6qate--