Skip to content

Commit

Permalink
Remove vn_rename and vn_remove dependency
Browse files Browse the repository at this point in the history
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 <mail@gmelikov.ru>
Reviewed-by: Arkadiusz Bubała <arkadiusz.bubala@open-e.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs/spl#648 
Closes openzfs#6753
  • Loading branch information
behlendorf authored and FransUrbo committed Apr 28, 2019
1 parent 930f260 commit 24fd48b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions module/zfs/spa_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 24fd48b

Please sign in to comment.