git: aa8c1f8d84d2 - main - nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write

Konstantin Belousov kostikbel at gmail.com
Sat Jan 23 20:29:46 UTC 2021


On Sun, Jan 24, 2021 at 05:08:52AM +0900, Yasuhiro Kimura wrote:
> From: Konstantin Belousov <kib at FreeBSD.org>
> Subject: git: aa8c1f8d84d2 - main - nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write
> Date: Sat, 23 Jan 2021 15:25:36 GMT
> 
> > The branch main has been updated by kib:
> > 
> > URL: https://cgit.FreeBSD.org/src/commit/?id=aa8c1f8d84d2638a354e71f9593e978d00878243
> > 
> > commit aa8c1f8d84d2638a354e71f9593e978d00878243
> > Author:     Konstantin Belousov <kib at FreeBSD.org>
> > AuthorDate: 2021-01-22 21:47:06 +0000
> > Commit:     Konstantin Belousov <kib at FreeBSD.org>
> > CommitDate: 2021-01-23 15:24:32 +0000
> > 
> >     nfs client: block vnode_pager_setsize() calls from nfscl_loadattrcache in nfs_write
> >     
> >     Otherwise writing thread might wait on sbusy state of the pages which were
> >     busied by itself, similarly to nfs_read().  But also we need to clear
> >     NVNSETSZKSIP flag possibly set by ncl_pager_setsize(), to not undo
> >     extension done by write.
> >     
> >     Reported by:    bdrewery
> >     Reviewed by:    rmacklem
> >     Tested by:      pho
> >     MFC after:      1 week
> >     Sponsored by:   The FreeBSD Foundation
> >     Differential Revision:  https://reviews.freebsd.org/D28306
> 
> On my 14-CURRENT amd64 environment this commit causes the problem that
> garbage date are written to file mounted with NFS.
> 
> I use NFSv4 and autofs to mount home directory on my 12.2-RELEASE
> amd64 server. And I use zsh as login shell and configure it so command
> history is written to history file each time any command is executed.
> 
> After update to 519b64e27fddf10c0b7f6a615edbad730b8c6c45, I see
> following error message if I try to execute any command.
> 
> ----------------------------------------------------------------------
> yasu at rolling-vm-freebsd1[1009]% ls
> zsh: corrupt history file /home/yasu/.zhistory
> yasu at rolling-vm-freebsd1[1010]%
> ----------------------------------------------------------------------
> 
> I logged in the server and check the content of history file. Then
> some garbase data are written to history file.
> 
> I confirmed the problem disappears by reverting this commit.

Try this.  Does the problem disappear with the following patch applied?

diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c
index 7d0ff0abff3d..ba72c728ca1e 100644
--- a/sys/fs/nfsclient/nfs_clbio.c
+++ b/sys/fs/nfsclient/nfs_clbio.c
@@ -1286,11 +1286,11 @@ ncl_write(struct vop_write_args *ap)
 
 out:
 	curthread_pflags2_restore(save2);
-	if ((curthread->td_pflags2 & TDP2_SBPAGES) == 0) {
+/*	if ((curthread->td_pflags2 & TDP2_SBPAGES) == 0) {
 		NFSLOCKNODE(np);
 		ncl_pager_setsize(vp, NULL);
 	}
-
+*/
 	return (error);
 }
 


More information about the dev-commits-src-all mailing list