Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/msdosfs When truncating a file purge the fat cache af...



details:   https://anonhg.NetBSD.org/src/rev/2ecdb8d20d9f
branches:  trunk
changeset: 763510:2ecdb8d20d9f
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Mar 22 20:33:51 2011 +0000

description:
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.

diffstat:

 sys/fs/msdosfs/msdosfs_denode.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 3580c28e1d7a -r 2ecdb8d20d9f sys/fs/msdosfs/msdosfs_denode.c
--- a/sys/fs/msdosfs/msdosfs_denode.c   Tue Mar 22 17:07:11 2011 +0000
+++ b/sys/fs/msdosfs/msdosfs_denode.c   Tue Mar 22 20:33:51 2011 +0000
@@ -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.



Home | Main Index | Thread Index | Old Index