From 24fd48b7ed95bfdbb071061520565c0fb2ee0aca Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 19 Oct 2017 10:06:55 -0700 Subject: [PATCH] Remove vn_rename and vn_remove dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The only place vn_rename and vn_remove are used is when writing out an updated pool configuration file. By truncating the file instead of renaming and removing it we can avoid having to implement these interfaces entirely. Functionally an empty cache file is treated the same as a missing cache file. This is particularly advantageous because the Linux kernel has never provided a way to reliably implement vn_rename and vn_remove. The cachefile_004_pos.ksh test case was updated to understand that an empty cache file is the same as a missing one. The zfs-import-* systemd service files were not updated to use ConditionFileNotEmpty in place of ConditionPathExists. This means that after exporting all pools and rebooting new pools will not the scanned for on the next boot. This small change should not impact normal usage since pools are not exported as part of a normal shutdown. Documentation was updated accordingly. Reviewed-by: George Melikov Reviewed-by: Arkadiusz BubaƂa Signed-off-by: Brian Behlendorf Closes zfsonlinux/spl#648 Closes #6753 --- module/zfs/spa_config.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/module/zfs/spa_config.c b/module/zfs/spa_config.c index 479a81f1282f..0ee46c2f28b0 100644 --- a/module/zfs/spa_config.c +++ b/module/zfs/spa_config.c @@ -181,12 +181,10 @@ spa_config_write(spa_config_dirent_t *dp, nvlist_t *nvl) * If the nvlist is empty (NULL), then remove the old cachefile. */ if (nvl == NULL) { - err = vn_remove(dp->scd_path, UIO_SYSSPACE, RMFILE); - /* - * Don't report an error when the cache file is already removed - */ + err = spa_config_remove(dp); if (err == ENOENT) err = 0; + return (err); }