Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/ffs allow also the snapshot_setup()'s call to ffs_tr...
details: https://anonhg.NetBSD.org/src/rev/f0ec5d868008
branches: trunk
changeset: 348500:f0ec5d868008
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Thu Oct 20 20:17:46 2016 +0000
description:
allow also the snapshot_setup()'s call to ffs_truncate() fail, the code
should simply reuse the file blocks in that case; also make sure the
ffs_truncate() call is run within transaction if log is on
diffstat:
sys/ufs/ffs/ffs_snapshot.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diffs (54 lines):
diff -r 42a45d10452a -r f0ec5d868008 sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c Thu Oct 20 19:31:32 2016 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c Thu Oct 20 20:17:46 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_snapshot.c,v 1.140 2015/06/28 10:04:32 maxv Exp $ */
+/* $NetBSD: ffs_snapshot.c,v 1.141 2016/10/20 20:17:46 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.140 2015/06/28 10:04:32 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.141 2016/10/20 20:17:46 jdolecek Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -402,6 +402,10 @@
}
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);
}
@@ -437,9 +441,13 @@
return EACCES;
if (vp->v_size != 0) {
- error = ffs_truncate(vp, 0, 0, NOCRED);
- if (error)
- return error;
+ 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);
+ }
}
/* Change inode to snapshot type file. */
@@ -448,6 +456,7 @@
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);
Home |
Main Index |
Thread Index |
Old Index