mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
OpenZFS 7301 - zpool export -f should be able to interrupt file freeing
Authored by: Alek Pinchuk <alek@nexenta.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com> Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com> Reviewed by: John Kennedy <john.kennedy@delphix.com> Approved by: Gordon Ross <gordon.ross@nexenta.com> Reviewed-by: Tim Chase <tim@chase2k.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Ported-by: George Melikov <mail@gmelikov.ru> OpenZFS-issue: https://www.illumos.org/issues/7301 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/eb72182 Closes #5680
This commit is contained in:
committed by
Brian Behlendorf
parent
cc9bb3e58e
commit
a08abc1bb3
+20
-1
@@ -23,7 +23,7 @@
|
||||
* Copyright (c) 2011, 2016 by Delphix. All rights reserved.
|
||||
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
|
||||
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
|
||||
* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2016, Nexenta Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2015 by Chunwei Chen. All rights reserved.
|
||||
*/
|
||||
|
||||
@@ -705,6 +705,22 @@ get_next_chunk(dnode_t *dn, uint64_t *start, uint64_t minimum)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* If this objset is of type OST_ZFS return true if vfs's unmounted flag is set,
|
||||
* otherwise return false.
|
||||
* Used below in dmu_free_long_range_impl() to enable abort when unmounting
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static boolean_t
|
||||
dmu_objset_zfs_unmounting(objset_t *os)
|
||||
{
|
||||
#ifdef _KERNEL
|
||||
if (dmu_objset_type(os) == DMU_OST_ZFS)
|
||||
return (zfs_get_vfs_flag_unmounted(os));
|
||||
#endif
|
||||
return (B_FALSE);
|
||||
}
|
||||
|
||||
static int
|
||||
dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset,
|
||||
uint64_t length)
|
||||
@@ -726,6 +742,9 @@ dmu_free_long_range_impl(objset_t *os, dnode_t *dn, uint64_t offset,
|
||||
uint64_t chunk_end, chunk_begin;
|
||||
dmu_tx_t *tx;
|
||||
|
||||
if (dmu_objset_zfs_unmounting(dn->dn_objset))
|
||||
return (SET_ERROR(EINTR));
|
||||
|
||||
chunk_end = chunk_begin = offset + length;
|
||||
|
||||
/* move chunk_begin backwards to the beginning of this chunk */
|
||||
|
||||
Reference in New Issue
Block a user