Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2231954rbb; Tue, 27 Feb 2024 15:30:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVusB0J45KQwmxutHVldqw0D/EzhUVoYZkxtB4i/JOz4gc7dFrTdUidkSARhLJuFoSW3sSTuWmtw/Lc/EPK7d7ykdFZ5ERKs8/WrTBHIw== X-Google-Smtp-Source: AGHT+IHjA/gkPmS27H4u+yK8WutnN9VjM01+lej7T7bzE2TWQzbLWOYQOhog+UMHpdmgFI7+pZG0 X-Received: by 2002:aa7:d841:0:b0:566:f60:4fc4 with SMTP id f1-20020aa7d841000000b005660f604fc4mr4348139eds.37.1709076651840; Tue, 27 Feb 2024 15:30:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709076651; cv=pass; d=google.com; s=arc-20160816; b=ZYv8GW3VOfr/tbnpyjWQjwVu47pDrQG56gVLjJiG5Y35BsHoE75S9LY5pRYZH/WHrs x7GW+d41DEdboH6b0eBhvC1lYj60hT5hnsYKGlE36Wbf55OyX9KWy6gcBYBEiNlwAnZR pOa06XNBsxWNeQZuXrM6q/l0Hua5II9MN0bMxe7c/N51n3OKG++4dFuO28PaHrGOusJ7 eCkdztpLrajBLK2E7dvP88yyJMqwrUtfm8GXjfyEGrEBaUAVdxpGMfeIyNoWDOyVRVxK sZCBXV6+v5Tj8n/2Iqf1pRR+XL78uijvrm4O+cKzq5X6H9UsXafR6lzZXf96Nad7dHp6 T6Cg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date: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=aUo1Lmwh7qTNT/9WsS+S6D9aEegzP0TKGCitjsP75Us=; fh=QX6zHiohncNiNOUI+U8YvGJ+LlxTpv/HOxHKoH9k58A=; b=swek4hzvistpnpq22OEPyrBCmzJi2f9dFlLBp2aT5FYojwARBg1OdadYN04I2OmDPb lpYN1Q82Wtud8/LDZMuzCneSSP5Yzttyp8nbkn/zPu2AOuuRZdIwUVx08VR8mugSu7TE VePZ9opbzfBKnRPWO5ULpze1Z3Dl5eaR26VgX85tA6LTAWpFgKlLiuU7dtTUehIle31t VvI88+QFWsu/tr6bL0xO9EZ7RpuZhbjt05bK439fAd1vW6jf2wUiIr06DceA+N9uF4j5 k5/ZKul+Dsul2SYHtoBkheMhGRiFBDIHOFoTBQMXxhXB+TPQR/yTeRxfIQNT4+QVZ5d3 YjDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="c/LVuXnd"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=wPnjUElR; 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-2100-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2100-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p12-20020aa7d30c000000b00563f5f25f41si1087372edq.373.2024.02.27.15.30.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 15:30:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2100-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="c/LVuXnd"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=wPnjUElR; 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-2100-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2100-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 649A71F2475C for ; Tue, 27 Feb 2024 23:30:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EE0A58231; Tue, 27 Feb 2024 23:25:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="c/LVuXnd"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="xJUfV6NS"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="wPnjUElR"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="sa75unVR" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 CCC8558200; Tue, 27 Feb 2024 23:25:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709076359; cv=none; b=fvdnOg+gt2ZNfxoW7wXwCt0UM4tlgPDHE44K5huSFuRqez341Oymb1bVN5wZZxXuPLIUo+3v7j3AxmKei4C3bkZB+FG63C7TNQ3xzqjNQAhm7oS8r8UGcXOeYy3BJYdUVR+RSOOvyzSVmBbuU4LWjkO6CAN51HtCJ1AaSKk14P0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709076359; c=relaxed/simple; bh=AEf1gpZiNu/8Da6o7+1FPM6KvYB5XGpOqOLGqNoPh8I=; h=Content-Type:MIME-Version:From:To:Cc:Subject:Date:Message-id; b=U93IrjwHznztmu+7LTTWdQbIGT2UrEDU1eE2WchCISHdhb3ZT6FJwPyBNUfPpFdQJMB0BB2ACDF337ed+D2C/cWy51LyKGDEHW8qcYmjE3+leu2RWPmcr8FZShFL6ymP6wNS2jxKdrN3f7ntrQG7TJgKuPLsmnDLFTLHeyF9RIE= 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=c/LVuXnd; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=xJUfV6NS; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=wPnjUElR; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=sa75unVR; arc=none smtp.client-ip=195.135.223.131 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 [IPv6:2a07:de40:b281:104: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-out2.suse.de (Postfix) with ESMTPS id D10021F453; Tue, 27 Feb 2024 23:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709076356; 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; bh=aUo1Lmwh7qTNT/9WsS+S6D9aEegzP0TKGCitjsP75Us=; b=c/LVuXndvRCb92BV/Lmy9AwuIvZDKANUSpZo4Vi9Sknb17cnLdEQ7UCA0HpY1OPemSud1S XpZKe4d+mmNFlMzKGWBKQ0MQOgb37U2nowyVIx/eQ/aMoe54H9Y8V1nA2nS/qBTmqEgJat 4hFBaGbWqEppXOKiD/eR+YMFxuf/tPI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709076356; 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; bh=aUo1Lmwh7qTNT/9WsS+S6D9aEegzP0TKGCitjsP75Us=; b=xJUfV6NScYcptXCEMAazlof+mLjYP/tdbzvYKBgsBWW0CI1Ds8Ycev/hsP6Bf6mHoY1ocI gdVtyo8zOqM4JpBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1709076355; 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; bh=aUo1Lmwh7qTNT/9WsS+S6D9aEegzP0TKGCitjsP75Us=; b=wPnjUElRjRSZeZHdCnszerg5CepUFZX9PcP4nDVvfnXYyxMjK3hllAWBBCqQEZCKsLuteL nXUzK6a9pwrapiVJmKnQXudJyfOKx+qQQZn/Nlws0tItjCllFOTIOYUAz0oNL7W7dfWrm8 cW3yxHSGEQRMT4XGjHZRnAJTOpoWwAQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1709076355; 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; bh=aUo1Lmwh7qTNT/9WsS+S6D9aEegzP0TKGCitjsP75Us=; b=sa75unVRQrmEo/y6ooENv+u4KFrjev4nMTfeclIXUElj23+rCTc7bJ8Vcf/bn3gTPED2JB wniVOFvuKDtCeMDA== 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 92D7A13ABA; Tue, 27 Feb 2024 23:25:53 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id 18t0DYFv3mW0NAAAD6G6ig (envelope-from ); Tue, 27 Feb 2024 23:25:53 +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: stable@vger.kernel.org, Trond Myklebust , Anna Schumaker Cc: linux-nfs@vger.kernel.org, Jacek Tomaka Subject: [PATCH stable 6.1] NFS: Fix data corruption caused by congestion. Date: Wed, 28 Feb 2024 10:25:49 +1100 Message-id: <170907634991.24797.14120500624611379941@noble.neil.brown.name> Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=wPnjUElR; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=sa75unVR X-Spamd-Result: default: False [-4.12 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[poczta.fm]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DWL_DNSWL_HI(-3.50)[suse.de:dkim]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[vger.kernel.org,poczta.fm]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.31)[75.34%] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: D10021F453 X-Spam-Level: X-Spam-Score: -4.12 X-Spam-Flag: NO when AOP_WRITEPAGE_ACTIVATE is returned (as NFS does when it detects congestion) it is important that the page 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. From 6.3 onward the patch is different as it needs to mention "folio", not "page". 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 f41d24b54fd1..6a0606668417 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -667,8 +667,10 @@ static int nfs_writepage_locked(struct page *page, int err; if (wbc->sync_mode == WB_SYNC_NONE && - NFS_SERVER(inode)->write_congested) + NFS_SERVER(inode)->write_congested) { + redirty_page_for_writepage(wbc, page); return AOP_WRITEPAGE_ACTIVATE; + } nfs_inc_stats(inode, NFSIOS_VFSWRITEPAGE); nfs_pageio_init_write(&pgio, inode, 0, -- 2.43.0