aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorKleber TarcĂ­sio <[email protected]>2021-02-09 16:14:59 -0300
committerGitHub <[email protected]>2021-02-09 11:14:59 -0800
commit4f22619ae3ab62c60ae718bd911eb2d988ae168d (patch)
treeb381b2e0ae149acf19de418ba5ffabe3fdbc2ddf /module
parentf8ce8aed0c8d1bf0b18f461863e68eae74a83585 (diff)
Add an assert to clarify code
The first time through the loop prevdb and prevhdl are NULL. They are then both set, but only prevdb is checked. Add an ASSERT to make it clear that prevhdl must be set when prevdb is. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Kleber <[email protected]> Closes #10754 Closes #11575
Diffstat (limited to 'module')
-rw-r--r--module/os/freebsd/zfs/zfs_znode.c4
-rw-r--r--module/os/linux/zfs/zfs_znode.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/module/os/freebsd/zfs/zfs_znode.c b/module/os/freebsd/zfs/zfs_znode.c
index 795abcbd3..242f169dc 100644
--- a/module/os/freebsd/zfs/zfs_znode.c
+++ b/module/os/freebsd/zfs/zfs_znode.c
@@ -1905,8 +1905,10 @@ zfs_obj_to_path_impl(objset_t *osp, uint64_t obj, sa_handle_t *hdl,
size_t complen;
int is_xattrdir;
- if (prevdb)
+ if (prevdb) {
+ ASSERT(prevhdl != NULL);
zfs_release_sa_handle(prevhdl, prevdb, FTAG);
+ }
if ((error = zfs_obj_to_pobj(osp, sa_hdl, sa_table, &pobj,
&is_xattrdir)) != 0)
diff --git a/module/os/linux/zfs/zfs_znode.c b/module/os/linux/zfs/zfs_znode.c
index b33594488..3588a428a 100644
--- a/module/os/linux/zfs/zfs_znode.c
+++ b/module/os/linux/zfs/zfs_znode.c
@@ -2127,8 +2127,10 @@ zfs_obj_to_path_impl(objset_t *osp, uint64_t obj, sa_handle_t *hdl,
size_t complen;
int is_xattrdir = 0;
- if (prevdb)
+ if (prevdb) {
+ ASSERT(prevhdl != NULL);
zfs_release_sa_handle(prevhdl, prevdb, FTAG);
+ }
if ((error = zfs_obj_to_pobj(osp, sa_hdl, sa_table, &pobj,
&is_xattrdir)) != 0)