diff options
author | George Melikov <[email protected]> | 2017-01-27 22:46:39 +0300 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-01-27 11:46:39 -0800 |
commit | a08abc1bb3e354d8c352c91d22cc733a84fafb50 (patch) | |
tree | 5ae2e2dff6f9ee2c2927aabf03a064bb8e6e4fd2 /module/zfs/dmu.c | |
parent | cc9bb3e58e926d4e056a89046301c1349755957b (diff) |
OpenZFS 7301 - zpool export -f should be able to interrupt file freeing
Authored by: Alek Pinchuk <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Reviewed by: Sanjay Nadkarni <[email protected]>
Reviewed by: Saso Kiselkov <[email protected]>
Reviewed by: John Kennedy <[email protected]>
Approved by: Gordon Ross <[email protected]>
Reviewed-by: Tim Chase <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Ported-by: George Melikov <[email protected]>
OpenZFS-issue: https://www.illumos.org/issues/7301
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/eb72182
Closes #5680
Diffstat (limited to 'module/zfs/dmu.c')
-rw-r--r-- | module/zfs/dmu.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c index 30c3b2cd0..cdbcfe250 100644 --- a/module/zfs/dmu.c +++ b/module/zfs/dmu.c @@ -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 */ |