aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2020-12-09 14:52:45 -0800
committerGitHub <[email protected]>2020-12-09 14:52:45 -0800
commitedb20ff3bab31f9e07578a7bf8279d67b821f29a (patch)
tree6a9107f9519f61c9fba275ab00c92894187bbc35 /module
parent1a735e763a4e008d654c0239f905fec2cc3cfd42 (diff)
Fix optional "force" arg handing in zfs_ioc_pool_sync()
The fnvlist_lookup_boolean_value() function should not be used to check the force argument since it's optional. It may not be provided or may have been created with the wrong flags. Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #11281 Closes #11284
Diffstat (limited to 'module')
-rw-r--r--module/zfs/zfs_ioctl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
index 33bd39aa2..74f05e268 100644
--- a/module/zfs/zfs_ioctl.c
+++ b/module/zfs/zfs_ioctl.c
@@ -6648,14 +6648,17 @@ static int
zfs_ioc_pool_sync(const char *pool, nvlist_t *innvl, nvlist_t *onvl)
{
int err;
- boolean_t force = B_FALSE;
+ boolean_t rc, force = B_FALSE;
spa_t *spa;
if ((err = spa_open(pool, &spa, FTAG)) != 0)
return (err);
- if (innvl)
- force = fnvlist_lookup_boolean_value(innvl, "force");
+ if (innvl) {
+ err = nvlist_lookup_boolean_value(innvl, "force", &rc);
+ if (err == 0)
+ force = rc;
+ }
if (force) {
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_WRITER);
@@ -6666,7 +6669,7 @@ zfs_ioc_pool_sync(const char *pool, nvlist_t *innvl, nvlist_t *onvl)
spa_close(spa, FTAG);
- return (err);
+ return (0);
}
/*