From 5c68a1518a4dcde592604aecbfa274bc0d851124 Mon Sep 17 00:00:00 2001 From: chs Date: Mon, 1 Jan 2001 00:25:41 +0000 Subject: [PATCH] zero the pages for newly allocated clusters in deextend() after we notify UVM of the file's new size rather than in extendfile(). fixes PR 11852. --- sys/msdosfs/msdosfs_denode.c | 8 ++++++-- sys/msdosfs/msdosfs_fat.c | 9 +-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c index cf1fc3a00ac8..b6afcfe0562b 100644 --- a/sys/msdosfs/msdosfs_denode.c +++ b/sys/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_denode.c,v 1.47 2000/11/27 08:39:46 chs Exp $ */ +/* $NetBSD: msdosfs_denode.c,v 1.48 2001/01/01 00:25:41 chs Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -490,7 +490,7 @@ deextend(dep, length, cred) struct ucred *cred; { struct msdosfsmount *pmp = dep->de_pmp; - u_long count; + u_long count, osize; int error; /* @@ -523,8 +523,12 @@ deextend(dep, length, cred) } } + osize = dep->de_FileSize; dep->de_FileSize = length; + uvm_vnp_setsize(DETOV(dep), (voff_t)dep->de_FileSize); dep->de_flag |= DE_UPDATE|DE_MODIFIED; + uvm_vnp_zerorange(DETOV(dep), (off_t)osize, + (size_t)(dep->de_FileSize - osize)); return (deupdat(dep, 1)); } diff --git a/sys/msdosfs/msdosfs_fat.c b/sys/msdosfs/msdosfs_fat.c index 03d20776cc04..88810964ef6d 100644 --- a/sys/msdosfs/msdosfs_fat.c +++ b/sys/msdosfs/msdosfs_fat.c @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_fat.c,v 1.35 2000/12/04 11:54:39 fvdl Exp $ */ +/* $NetBSD: msdosfs_fat.c,v 1.36 2001/01/01 00:25:41 chs Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -1070,12 +1070,5 @@ extendfile(dep, count, bpp, ncp, flags) } } - if ((flags & DE_CLEAR) && !(dep->de_Attributes & ATTR_DIRECTORY)) { - int cnshift = pmp->pm_cnshift; - - uvm_vnp_zerorange(DETOV(dep), frcn << cnshift, - origcount << cnshift); - } - return (0); }