svn commit: r346074 - stable/12/sys/fs/msdosfs

Konstantin Belousov kib at FreeBSD.org
Wed Apr 10 08:34:19 UTC 2019


Author: kib
Date: Wed Apr 10 08:34:17 2019
New Revision: 346074
URL: https://svnweb.freebsd.org/changeset/base/346074

Log:
  MFC r345847:
  msdosfs: zero tail of the last block on truncation for VREG vnodes as well.

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

Modified: stable/12/sys/fs/msdosfs/msdosfs_denode.c
==============================================================================
--- stable/12/sys/fs/msdosfs/msdosfs_denode.c	Wed Apr 10 08:17:56 2019	(r346073)
+++ stable/12/sys/fs/msdosfs/msdosfs_denode.c	Wed Apr 10 08:34:17 2019	(r346074)
@@ -405,19 +405,21 @@ detrunc(struct denode *dep, u_long length, int flags, 
 			bn = cntobn(pmp, eofentry);
 			error = bread(pmp->pm_devvp, bn, pmp->pm_bpcluster,
 			    NOCRED, &bp);
-			if (error) {
-				brelse(bp);
+		} else {
+			error = bread(DETOV(dep), de_cluster(pmp, length),
+			    pmp->pm_bpcluster, cred, &bp);
+		}
+		if (error) {
 #ifdef MSDOSFS_DEBUG
-				printf("detrunc(): bread fails %d\n", error);
+			printf("detrunc(): bread fails %d\n", error);
 #endif
-				return (error);
-			}
-			memset(bp->b_data + boff, 0, pmp->pm_bpcluster - boff);
-			if (flags & IO_SYNC)
-				bwrite(bp);
-			else
-				bdwrite(bp);
+			return (error);
 		}
+		memset(bp->b_data + boff, 0, pmp->pm_bpcluster - boff);
+		if ((flags & IO_SYNC) != 0)
+			bwrite(bp);
+		else
+			bdwrite(bp);
 	}
 
 	/*


More information about the svn-src-all mailing list