Module Name: src
Committed By: jdolecek
Date: Fri Oct 21 19:28:03 UTC 2016
Modified Files:
src/sys/ufs/ffs: ffs_snapshot.c
Log Message:
revert 1.141 - the second ffs_truncate() can't really fail
requested by hannken@
To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/ufs/ffs/ffs_snapshot.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/ffs/ffs_snapshot.c
diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.141 src/sys/ufs/ffs/ffs_snapshot.c:1.142
--- src/sys/ufs/ffs/ffs_snapshot.c:1.141 Thu Oct 20 20:17:46 2016
+++ src/sys/ufs/ffs/ffs_snapshot.c Fri Oct 21 19:28:03 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_snapshot.c,v 1.141 2016/10/20 20:17:46 jdolecek Exp $ */
+/* $NetBSD: ffs_snapshot.c,v 1.142 2016/10/21 19:28:03 jdolecek Exp $ */
/*
* Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.141 2016/10/20 20:17:46 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.142 2016/10/21 19:28:03 jdolecek Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -402,10 +402,6 @@ out:
}
if (error) {
if (UFS_WAPBL_BEGIN(mp) == 0) {
- /*
- * This is okay to fail, we'll simply reuse the blocks
- * later.
- */
(void) ffs_truncate(vp, (off_t)0, 0, NOCRED);
UFS_WAPBL_END(mp);
}
@@ -441,13 +437,9 @@ snapshot_setup(struct mount *mp, struct
return EACCES;
if (vp->v_size != 0) {
- if (UFS_WAPBL_BEGIN(mp) == 0) {
- /*
- * This is okay to fail, we'll simply reuse the blocks
- */
- (void) ffs_truncate(vp, 0, 0, NOCRED);
- UFS_WAPBL_END(mp);
- }
+ error = ffs_truncate(vp, 0, 0, NOCRED);
+ if (error)
+ return error;
}
/* Change inode to snapshot type file. */
@@ -456,7 +448,6 @@ snapshot_setup(struct mount *mp, struct
return error;
#if defined(QUOTA) || defined(QUOTA2)
/* shapshot inodes are not accounted in quotas */
- chkdq(ip, -DIP(ip, blocks), l->l_cred, 0);
chkiq(ip, -1, l->l_cred, 0);
#endif
ip->i_flags |= (SF_SNAPSHOT | SF_SNAPINVAL);