Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp519919lqi; Thu, 7 Mar 2024 04:27:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUeF8+NUbd+ro48kvWgCxR6zEW76olAQXU8JCTMI+hR8QWYSrl9Qt0JZEUYsWcnvEAvwLQqZtfPz+Lv8A6WQtuY6f6SZG3qQHhvdAmmsw== X-Google-Smtp-Source: AGHT+IGQAqXoW64zxMd7bPlYz1807BdO1jbF3yyB9Z59nLVRM/nt+MVcPgXJQIXFAbCGnW5V6vkf X-Received: by 2002:a05:620a:b15:b0:788:209e:752a with SMTP id t21-20020a05620a0b1500b00788209e752amr7935043qkg.63.1709814427966; Thu, 07 Mar 2024 04:27:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709814427; cv=pass; d=google.com; s=arc-20160816; b=QJZdU7A3mpu7QZf5+FWZBpeNWRiF54xZS3XSl+G80U0pyJ8g64ri279mn8y1HsTLH0 vYPcBkafsy9c7+tmqb9LKmxFVVzVj4Ryv9VDwHavtrOPFCdPEb2q9AN+sz0lUI3oZEWT zk3R/3xD6bLezqlLwti2Xc+oDih9cBEPp4nOpdQNl/8YXpBuwKXx705+zXhSvX4E6qP+ lDIFCDR7DZaHmnru5xo7yEfPhnBlewPOVBKC5knaif3OilSWjzAuItgAAXjD56TSaQlm pdEV8zm07UQicVrfYDbZy94Ibq30dox3r16ghE2cMtqb53j9l9zdNC4FTKgQdkb7Ouex Ae8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:references:in-reply-to:subject:cc:to:from :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:dkim-signature:dkim-signature :dkim-signature:dkim-signature; bh=8lgx+StLjDkO3YYKmbxg12umPyztFQfIPqwIN0q1WYE=; fh=KAVgz/gcpXR0A+mN/7gyJJY3q6pTF1gEcJPuvgdvQM0=; b=nBPpPxHTTLNBkSxY/vkMgEhTWSRJ8wrZFUlrumCJPUkn3XTDM84PPt+STUWoUFa+f9 SCNYJ3qPWzXMgcoU0FcTMFPp0KrkC+AUjJZcRgf9HZUBMKZa1EQ8Z8IQCHIOLLTxmo3k iDNjFcqH7Whc//6xGN67u6RflmLX6w48rz0wk4cIBQAqpY3oylPPW0wPNJIa0Z3eQMrR mfxZLmYFPOlTv1J24cA9eVix5QflZ05kUJnM5xM2FGSFJRO5yBMylSeftlcCvAzgdqWR YPPjb91voUoxZ3wO3oRMUo7UtOYqjQEV3tXV7Y18qik67EyXfcYSQ04fhXUPxftJSPgB 8dLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=dzYjVHHz; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SHbLip5L; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-nfs+bounces-2227-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2227-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 10-20020a05620a040a00b00788260dc980si9284194qkp.446.2024.03.07.04.27.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 04:27:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2227-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=dzYjVHHz; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SHbLip5L; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-nfs+bounces-2227-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2227-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 364681C222F0 for ; Thu, 7 Mar 2024 12:26:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 63F6E12A154; Thu, 7 Mar 2024 12:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="dzYjVHHz"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="bsQVyYHi"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="SHbLip5L"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="fNHQXagz" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF25D85295; Thu, 7 Mar 2024 12:26:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709814404; cv=none; b=qPVfFg8ZGgwNElD+e4eCXzcfyIetAZIwBFMNXI8UjcszQm8/M22lMecfFLadyQjPig7EE9++VcveXqTz7Sstri5eCIw9HYrtCOUKc5jNp8NJ25k6nvSVusdaOSquB2agfOjZcCp0szWiJizMWCGLP6+3rWwe3LEDJMvdG64BTNg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709814404; c=relaxed/simple; bh=BhNGlpsq99Ce0tfJp3Cxo3xzk/R9OIoRQOCGH3lcS1w=; h=Content-Type:MIME-Version:From:To:Cc:Subject:In-reply-to: References:Date:Message-id; b=li3rB6q1viD4GnsfW2tiruTomFhJw2clvPetFd22bzwpDlqXrk/05bpuexCU7lo6wgqep+Y2sDHqYvN/6Ad4jh3e8cHNTsc4LGlXU6j4U9FCPfW1XWwWXDk/svEmF6raLT4YSJ0eO1j4iWYGVRmM0qQ4vOBPTvIT+EL2lwAnisY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=dzYjVHHz; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=bsQVyYHi; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=SHbLip5L; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=fNHQXagz; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 522328CADD; Thu, 7 Mar 2024 11:41:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709811709; 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=8lgx+StLjDkO3YYKmbxg12umPyztFQfIPqwIN0q1WYE=; b=dzYjVHHzpSliGzafLPA+2yuxMihPcaZAioLEBF6Pvoch87/HcgfPUENd7EFr3Q53vHXMzk 00pNRJL0U2ysQI0RKyJbr4RtnFN9CutpOZ6k+VmzWpHnyS1OFOOnfcvm8QJ6V8cr9x4VGz 1C971132FEUmc2WYDqIzbXPqYUv0QqU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709811709; 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=8lgx+StLjDkO3YYKmbxg12umPyztFQfIPqwIN0q1WYE=; b=bsQVyYHiGTeNoAFpbRpWqbBIOcuQWR6Pe8akhIXCfhyiDm2EXxA7Y1biY7xXcE9koHuxAB gidzHjjWnNNBlBBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709811708; 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=8lgx+StLjDkO3YYKmbxg12umPyztFQfIPqwIN0q1WYE=; b=SHbLip5L3jZPWQgehFa2E/fq2LpQ3Uyqp79MY7n+VGICliELG+p37goMKihjD8PXOJ9WTv Ls+dpSO1+5wnbptaY7SRxq/dcjSDj7v9yHxjgB4GRa3ui1TvtTVRvrdgrBFydt9fuBnKvB i5DBTRSodNY3h3e8UZuW+tVFlSnhtq4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709811708; 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=8lgx+StLjDkO3YYKmbxg12umPyztFQfIPqwIN0q1WYE=; b=fNHQXagzFnMUvpgKPNM/s0ExGGb1Xj/+yIfvFiQdmn775K3XvMTEU4qDv3pIhYYJZKleJH 6bUeiDrJWPfsNgAg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id AC2CD12FC5; Thu, 7 Mar 2024 11:41:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id KZ/aE/mn6WVUOwAAD6G6ig (envelope-from ); Thu, 07 Mar 2024 11:41:45 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "NeilBrown" To: "Jeff Layton" Cc: stable@vger.kernel.org, "Trond Myklebust" , "Anna Schumaker" , linux-nfs@vger.kernel.org, "Dan Aloni" Subject: Re: [PATCH stable 6.6 and 6.7] NFS: Fix data corruption caused by congestion. In-reply-to: References: <170907621128.24797.4390391329078744015@noble.neil.brown.name>, Date: Thu, 07 Mar 2024 22:41:41 +1100 Message-id: <170981170160.13576.347273159851012933@noble.neil.brown.name> Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -1.30 X-Spamd-Result: default: False [-1.30 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.20)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[22.96%]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[poczta.fm:email,suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO On Thu, 07 Mar 2024, Jeff Layton wrote: > On Wed, 2024-02-28 at 10:23 +1100, NeilBrown wrote: > > when AOP_WRITEPAGE_ACTIVATE is returned (as NFS does when it detects > > congestion) it is important that the folio is redirtied. > > nfs_writepage_locked() doesn't do this, so files can become corrupted as > > writes can be lost. > > > > Note that this is not needed in v6.8 as AOP_WRITEPAGE_ACTIVATE cannot be > > returned. It is needed for kernels v5.18..v6.7. Prior to 6.3 the patch > > is different as it needs to mention "page", not "folio". > > > > Neil, I have a question about the above statement. In Linus's tree as of > this morning (v6.8-rc7-ish), it does this in nfs_writepages_locked: > > if (wbc->sync_mode == WB_SYNC_NONE && > NFS_SERVER(inode)->write_congested) > return AOP_WRITEPAGE_ACTIVATE; > > The only caller of nfs_writepages_locked, and I don't see where it > redirties the page. Why don't we need this in v6.8? You are right - it doesn't redirty anything. But there is no bug here.... I didn't see it at first either, but the only caller of nfs_writepage_locked() is nfs_wb_folio() (as you say) and that always passes a wbc with .sync_mode = WB_SYNC_ALL. So sync_mode is never WB_SYNC_NODE and the code snippet you included above is dead code. I've already posted a patch to Trond and Anna to remove that code. Thanks for the review! NeilBrown > > > > Reported-and-tested-by: Jacek Tomaka > > Fixes: 6df25e58532b ("nfs: remove reliance on bdi congestion") > > Signed-off-by: NeilBrown > > --- > > fs/nfs/write.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/fs/nfs/write.c b/fs/nfs/write.c > > index b664caea8b4e..9e345d3c305a 100644 > > --- a/fs/nfs/write.c > > +++ b/fs/nfs/write.c > > @@ -668,8 +668,10 @@ static int nfs_writepage_locked(struct folio *folio, > > int err; > > > > if (wbc->sync_mode == WB_SYNC_NONE && > > - NFS_SERVER(inode)->write_congested) > > + NFS_SERVER(inode)->write_congested) { > > + folio_redirty_for_writepage(wbc, folio); > > return AOP_WRITEPAGE_ACTIVATE; > > + } > > > > nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE); > > nfs_pageio_init_write(&pgio, inode, 0, false, > > -- > Jeff Layton >