Module Name:    src
Committed By:   hannken
Date:           Tue Mar 22 20:33:51 UTC 2011

Modified Files:
        src/sys/fs/msdosfs: msdosfs_denode.c

Log Message:
When truncating a file purge the fat cache after setting the new size
and after all io but before actually updating the cluster chain.

Both uvm_vnp_zerorange() and vtruncbuf() call get/putpages -> bmap -> pcbmap
and here the fat cache gets updated with information no longer valid after
truncation.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/fs/msdosfs/msdosfs_denode.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/msdosfs/msdosfs_denode.c
diff -u src/sys/fs/msdosfs/msdosfs_denode.c:1.41 src/sys/fs/msdosfs/msdosfs_denode.c:1.42
--- src/sys/fs/msdosfs/msdosfs_denode.c:1.41	Sun Mar 20 12:21:28 2011
+++ src/sys/fs/msdosfs/msdosfs_denode.c	Tue Mar 22 20:33:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_denode.c,v 1.41 2011/03/20 12:21:28 hannken Exp $	*/
+/*	$NetBSD: msdosfs_denode.c,v 1.42 2011/03/22 20:33:51 hannken Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.41 2011/03/20 12:21:28 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_denode.c,v 1.42 2011/03/22 20:33:51 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -461,8 +461,6 @@
 		}
 	}
 
-	fc_purge(dep, lastblock + 1);
-
 	/*
 	 * If the new length is not a multiple of the cluster size then we
 	 * must zero the tail end of the new last cluster in case it
@@ -506,6 +504,8 @@
 	       allerror, eofentry);
 #endif
 
+	fc_purge(dep, lastblock + 1);
+
 	/*
 	 * If we need to break the cluster chain for the file then do it
 	 * now.

Reply via email to