mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 11:29:36 +03:00
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 <ryan@iXsystems.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #11281 Closes #11284
This commit is contained in:
parent
1a735e763a
commit
edb20ff3ba
@ -6648,14 +6648,17 @@ static int
|
|||||||
zfs_ioc_pool_sync(const char *pool, nvlist_t *innvl, nvlist_t *onvl)
|
zfs_ioc_pool_sync(const char *pool, nvlist_t *innvl, nvlist_t *onvl)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
boolean_t force = B_FALSE;
|
boolean_t rc, force = B_FALSE;
|
||||||
spa_t *spa;
|
spa_t *spa;
|
||||||
|
|
||||||
if ((err = spa_open(pool, &spa, FTAG)) != 0)
|
if ((err = spa_open(pool, &spa, FTAG)) != 0)
|
||||||
return (err);
|
return (err);
|
||||||
|
|
||||||
if (innvl)
|
if (innvl) {
|
||||||
force = fnvlist_lookup_boolean_value(innvl, "force");
|
err = nvlist_lookup_boolean_value(innvl, "force", &rc);
|
||||||
|
if (err == 0)
|
||||||
|
force = rc;
|
||||||
|
}
|
||||||
|
|
||||||
if (force) {
|
if (force) {
|
||||||
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_WRITER);
|
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);
|
spa_close(spa, FTAG);
|
||||||
|
|
||||||
return (err);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user