NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/57606



The following reply was made to PR kern/57606; it has been noted by GNATS.

From: Merlin Scholz <merlin.scholz%tu-dortmund.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/57606
Date: Thu, 7 Sep 2023 10:12:16 +0200

 The following patch should fix the issue. It has been verified through 
 ATF and LockDoc.
 
 
 RCS file: /cvsroot/src/sys/ufs/ffs/ffs_vfsops.c,v
 retrieving revision 1.381
 diff -u -r1.381 ffs_vfsops.c
 --- src/sys/ufs/ffs/ffs_vfsops.c	15 Jun 2023 09:15:54 -0000	1.381
 +++ src/sys/ufs/ffs/ffs_vfsops.c	7 Sep 2023 08:05:06 -0000
 @@ -2021,14 +2021,20 @@
   	/*
   	 * Force stale file system control information to be flushed.
   	 */
 -	if (waitfor != MNT_LAZY && (ump->um_devvp->v_numoutput > 0 ||
 -	    !LIST_EMPTY(&ump->um_devvp->v_dirtyblkhd))) {
 -		vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
 -		if ((error = VOP_FSYNC(ump->um_devvp, cred,
 -		    (waitfor == MNT_WAIT ? FSYNC_WAIT : 0) | FSYNC_NOLOG,
 -		    0, 0)) != 0)
 -			allerror = error;
 -		VOP_UNLOCK(ump->um_devvp);
 +	if (waitfor != MNT_LAZY) {
 +		bool need_devvp_fsync;
 +		mutex_enter(ump->um_devvp->v_interlock);
 +		need_devvp_fsync = (ump->um_devvp->v_numoutput > 0 ||
 +		    !LIST_EMPTY(&ump->um_devvp->v_dirtyblkhd));
 +		mutex_exit(ump->um_devvp->v_interlock);
 +		if (need_devvp_fsync) {
 +			vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
 +			if ((error = VOP_FSYNC(ump->um_devvp, cred,
 +			    (waitfor == MNT_WAIT ? FSYNC_WAIT : 0) | FSYNC_NOLOG,
 +			    0, 0)) != 0)
 +				allerror = error;
 +			VOP_UNLOCK(ump->um_devvp);
 +		}
   	}
   #if defined(QUOTA) || defined(QUOTA2)
   	qsync(mp);
 



Home | Main Index | Thread Index | Old Index