Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Apr 2019 17:54:51 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r346287 - stable/12/sys/fs/msdosfs
Message-ID:  <201904161754.x3GHspIg044854@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Apr 16 17:54:51 2019
New Revision: 346287
URL: https://svnweb.freebsd.org/changeset/base/346287

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

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

Modified: stable/12/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- stable/12/sys/fs/msdosfs/msdosfs_fat.c	Tue Apr 16 17:43:14 2019	(r346286)
+++ stable/12/sys/fs/msdosfs/msdosfs_fat.c	Tue Apr 16 17:54:51 2019	(r346287)
@@ -54,6 +54,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>
@@ -979,6 +980,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);
+				}
 			}
 		}
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904161754.x3GHspIg044854>