mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
Illumos 4950 - files sometimes can't be removed from a full filesystem
4950 files sometimes can't be removed from a full filesystem Reviewed by: Adam Leventhal <adam.leventhal@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Sebastien Roy <sebastien.roy@delphix.com> Reviewed by: Boris Protopopov <bprotopopov@hotmail.com> Approved by: Dan McDonald <danmcd@omniti.com> References: https://www.illumos.org/issues/4950 https://github.com/illumos/illumos-gate/commit/4bb7380 Porting notes: - ZoL currently does not log discards to zvols, so the portion of this patch that modifies the discard logging to mark it as freeing space has been discarded. 2. may_delete_now had been removed from zfs_remove() in ZoL. It has been reintroduced. 3. We do not try to emulate vnodes, so the following lines are not valid on Linux: mutex_enter(&vp->v_lock); may_delete_now = vp->v_count == 1 && !vn_has_cached_data(vp); mutex_exit(&vp->v_lock); This has been replaced with: mutex_enter(&zp->z_lock); may_delete_now = atomic_read(&ip->i_count) == 1 && !(zp->z_is_mapped); mutex_exit(&zp->z_lock); Ported-by: Richard Yao <richard.yao@clusterhq.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
committed by
Brian Behlendorf
parent
dfe0d02734
commit
19d55079ae
@@ -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) 2012, 2014 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
/* Portions Copyright 2007 Jeremy Teo */
|
||||
@@ -1425,7 +1425,7 @@ zfs_grow_blocksize(znode_t *zp, uint64_t size, dmu_tx_t *tx)
|
||||
* IN: zp - znode of file to free data in.
|
||||
* end - new end-of-file
|
||||
*
|
||||
* RETURN: 0 on success, error code on failure
|
||||
* RETURN: 0 on success, error code on failure
|
||||
*/
|
||||
static int
|
||||
zfs_extend(znode_t *zp, uint64_t end)
|
||||
@@ -1545,7 +1545,7 @@ zfs_zero_partial_page(znode_t *zp, uint64_t start, uint64_t len)
|
||||
* off - start of section to free.
|
||||
* len - length of section to free.
|
||||
*
|
||||
* RETURN: 0 on success, error code on failure
|
||||
* RETURN: 0 on success, error code on failure
|
||||
*/
|
||||
static int
|
||||
zfs_free_range(znode_t *zp, uint64_t off, uint64_t len)
|
||||
@@ -1624,7 +1624,7 @@ zfs_free_range(znode_t *zp, uint64_t off, uint64_t len)
|
||||
* IN: zp - znode of file to free data in.
|
||||
* end - new end-of-file.
|
||||
*
|
||||
* RETURN: 0 on success, error code on failure
|
||||
* RETURN: 0 on success, error code on failure
|
||||
*/
|
||||
static int
|
||||
zfs_trunc(znode_t *zp, uint64_t end)
|
||||
@@ -1657,6 +1657,7 @@ zfs_trunc(znode_t *zp, uint64_t end)
|
||||
tx = dmu_tx_create(zsb->z_os);
|
||||
dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);
|
||||
zfs_sa_upgrade_txholds(tx, zp);
|
||||
dmu_tx_mark_netfree(tx);
|
||||
error = dmu_tx_assign(tx, TXG_WAIT);
|
||||
if (error) {
|
||||
dmu_tx_abort(tx);
|
||||
@@ -1691,7 +1692,7 @@ zfs_trunc(znode_t *zp, uint64_t end)
|
||||
* flag - current file open mode flags.
|
||||
* log - TRUE if this action should be logged
|
||||
*
|
||||
* RETURN: 0 on success, error code on failure
|
||||
* RETURN: 0 on success, error code on failure
|
||||
*/
|
||||
int
|
||||
zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
|
||||
|
||||
Reference in New Issue
Block a user