summaryrefslogtreecommitdiffstats
path: root/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-07-23 00:35:06 +0000
committerdelphij <delphij@FreeBSD.org>2014-07-23 00:35:06 +0000
commitffc18ded5bc79502d527f9ff35220d2a5e579225 (patch)
treebf62623a34aeeb725ec83c3dca937146ba6420fa /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
parentdc97077d62c55c6f91988f073e9e645c3eb7a5ee (diff)
downloadFreeBSD-src-ffc18ded5bc79502d527f9ff35220d2a5e579225.zip
FreeBSD-src-ffc18ded5bc79502d527f9ff35220d2a5e579225.tar.gz
MFC r268464: MFV r268452:
Explicitly mark file removal transactions as "presumed to result in a net free of space" so they will not fail with ENOSPC. Illumos issue: 4950 files sometimes can't be removed from a full filesystem
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
index fd02077..4a86fb2 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
@@ -20,7 +20,7 @@
*/
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2014 by Delphix. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/
@@ -1558,7 +1558,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp,
* cr - credentials of caller.
* flag - large file flag [UNUSED].
* ct - caller context
- * vsecp - ACL to be set
+ * vsecp - ACL to be set
*
* OUT: vpp - vnode of created or trunc'd entry.
*
@@ -1840,7 +1840,7 @@ zfs_remove(vnode_t *dvp, char *name, cred_t *cr, caller_context_t *ct,
zfsvfs_t *zfsvfs = dzp->z_zfsvfs;
zilog_t *zilog;
uint64_t acl_obj, xattr_obj;
- uint64_t xattr_obj_unlinked = 0;
+ uint64_t xattr_obj_unlinked = 0;
uint64_t obj = 0;
zfs_dirlock_t *dl;
dmu_tx_t *tx;
@@ -1940,6 +1940,14 @@ top:
/* charge as an update -- would be nice not to charge at all */
dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL);
+ /*
+ * Mark this transaction as typically resulting in a net free of
+ * space, unless object removal will be delayed indefinitely
+ * (due to active holds on the vnode due to the file being open).
+ */
+ if (may_delete_now)
+ dmu_tx_mark_netfree(tx);
+
error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
if (error) {
zfs_dirent_unlock(dl);
@@ -1970,7 +1978,6 @@ top:
}
if (unlinked) {
-
/*
* Hold z_lock so that we can make sure that the ACL obj
* hasn't changed. Could have been deleted due to
@@ -5039,13 +5046,13 @@ zfs_addmap(vnode_t *vp, offset_t off, struct as *as, caddr_t addr,
* last page is pushed. The problem occurs when the msync() call is omitted,
* which by far the most common case:
*
- * open()
- * mmap()
- * <modify memory>
- * munmap()
- * close()
- * <time lapse>
- * putpage() via fsflush
+ * open()
+ * mmap()
+ * <modify memory>
+ * munmap()
+ * close()
+ * <time lapse>
+ * putpage() via fsflush
*
* If we wait until fsflush to come along, we can have a modification time that
* is some arbitrary point in the future. In order to prevent this in the
@@ -5528,7 +5535,7 @@ const fs_operation_def_t zfs_dvnodeops_template[] = {
VOPNAME_PATHCONF, { .vop_pathconf = zfs_pathconf },
VOPNAME_GETSECATTR, { .vop_getsecattr = zfs_getsecattr },
VOPNAME_SETSECATTR, { .vop_setsecattr = zfs_setsecattr },
- VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
+ VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
NULL, NULL
};
@@ -5562,8 +5569,8 @@ const fs_operation_def_t zfs_fvnodeops_template[] = {
VOPNAME_GETSECATTR, { .vop_getsecattr = zfs_getsecattr },
VOPNAME_SETSECATTR, { .vop_setsecattr = zfs_setsecattr },
VOPNAME_VNEVENT, { .vop_vnevent = fs_vnevent_support },
- VOPNAME_REQZCBUF, { .vop_reqzcbuf = zfs_reqzcbuf },
- VOPNAME_RETZCBUF, { .vop_retzcbuf = zfs_retzcbuf },
+ VOPNAME_REQZCBUF, { .vop_reqzcbuf = zfs_reqzcbuf },
+ VOPNAME_RETZCBUF, { .vop_retzcbuf = zfs_retzcbuf },
NULL, NULL
};
OpenPOWER on IntegriCloud