svn commit: r346289 - stable/11/sys/fs/msdosfs

Konstantin Belousov kib at FreeBSD.org
Tue Apr 16 17:56:54 UTC 2019


Author: kib
Date: Tue Apr 16 17:56:53 2019
New Revision: 346289
URL: https://svnweb.freebsd.org/changeset/base/346289

Log:
  MFC r346064:
  Fix dirty buf exhaustion easily triggered with msdosfs.

Modified:
  stable/11/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- stable/11/sys/fs/msdosfs/msdosfs_fat.c	Tue Apr 16 17:55:54 2019	(r346288)
+++ stable/11/sys/fs/msdosfs/msdosfs_fat.c	Tue Apr 16 17:56:53 2019	(r346289)
@@ -52,6 +52,7 @@
 #include <sys/systm.h>
 #include <sys/buf.h>
 #include <sys/mount.h>
+#include <sys/vmmeter.h>
 #include <sys/vnode.h>
 
 #include <fs/msdosfs/bpb.h>
@@ -977,6 +978,7 @@ extendfile(struct denode *dep, u_long count, struct bu
 	u_long cn, got;
 	struct msdosfsmount *pmp = dep->de_pmp;
 	struct buf *bp;
+	struct vop_fsync_args fsync_ap;
 	daddr_t blkno;
 
 	/*
@@ -1086,8 +1088,16 @@ extendfile(struct denode *dep, u_long count, struct bu
 				if (bpp) {
 					*bpp = bp;
 					bpp = NULL;
-				} else
+				} else {
 					bdwrite(bp);
+				}
+				if (vm_page_count_severe() ||
+				    buf_dirty_count_severe()) {
+					fsync_ap.a_vp = DETOV(dep);
+					fsync_ap.a_waitfor = MNT_WAIT;
+					fsync_ap.a_td = curthread;
+					vop_stdfsync(&fsync_ap);
+				}
 			}
 		}
 	}


More information about the svn-src-stable mailing list