Module Name:    src
Committed By:   hannken
Date:           Wed Jan  4 10:04:17 UTC 2017

Modified Files:
        src/sys/ufs/ufs: ufs_inode.c

Log Message:
Change ufs_truncate_retry() to call UFS_TRUNCATE() at least once.
Even with "newsize == ip->i_size" it must set mtime etc.

Adresses PR kern/51762 "mtime not updated by open(O_TRUNC)"


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/ufs/ufs/ufs_inode.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/ufs/ufs/ufs_inode.c
diff -u src/sys/ufs/ufs/ufs_inode.c:1.97 src/sys/ufs/ufs/ufs_inode.c:1.98
--- src/sys/ufs/ufs/ufs_inode.c:1.97	Fri Oct 28 20:38:12 2016
+++ src/sys/ufs/ufs/ufs_inode.c	Wed Jan  4 10:04:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_inode.c,v 1.97 2016/10/28 20:38:12 jdolecek Exp $	*/
+/*	$NetBSD: ufs_inode.c,v 1.98 2017/01/04 10:04:17 hannken Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.97 2016/10/28 20:38:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_inode.c,v 1.98 2017/01/04 10:04:17 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -303,7 +303,7 @@ ufs_truncate_retry(struct vnode *vp, uin
 	/*
 	 * Truncate might temporarily fail, loop until done.
 	 */
-	while (ip->i_size != newsize) {
+	do {
 		error = UFS_WAPBL_BEGIN(mp);
 		if (error)
 			goto out;
@@ -313,7 +313,7 @@ ufs_truncate_retry(struct vnode *vp, uin
 
 		if (error != 0 && error != EAGAIN)
 			goto out;
-	}
+	} while (ip->i_size != newsize);
 
   out:
 	return error;

Reply via email to