aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/zap.c
diff options
context:
space:
mode:
authorWill Andrews <[email protected]>2013-06-11 09:13:38 -0800
committerBrian Behlendorf <[email protected]>2013-11-04 10:55:25 -0800
commit3a84951d7dfb5357509a1ed1699f80b71f87982a (patch)
tree66827915b516d4bea8466f1fd176b39664bddf41 /module/zfs/zap.c
parentd3cc8b152edc608fa4b73d4cb5354356da6b451c (diff)
Illumos #3743
3743 zfs needs a refcount audit Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: Eric Schrock <[email protected]> Reviewed by: George Wilson <[email protected]> Approved by: Christopher Siden <[email protected]> References: https://www.illumos.org/issues/3743 illumos/illumos-gate@b287be1ba86043996f49b1cc34c80cc620f9b841 Ported-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #1775
Diffstat (limited to 'module/zfs/zap.c')
-rw-r--r--module/zfs/zap.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/module/zfs/zap.c b/module/zfs/zap.c
index 66c303eb4..cfae26a74 100644
--- a/module/zfs/zap.c
+++ b/module/zfs/zap.c
@@ -295,7 +295,8 @@ zap_table_load(zap_t *zap, zap_table_phys_t *tbl, uint64_t idx, uint64_t *valp)
err = dmu_buf_hold(zap->zap_objset, zap->zap_object,
(tbl->zt_nextblk + blk) << bs, FTAG, &db,
DMU_READ_NO_PREFETCH);
- dmu_buf_rele(db, FTAG);
+ if (err == 0)
+ dmu_buf_rele(db, FTAG);
}
return (err);
}
@@ -992,18 +993,21 @@ zap_join(objset_t *os, uint64_t fromobj, uint64_t intoobj, dmu_tx_t *tx)
zap_attribute_t za;
int err;
+ err = 0;
for (zap_cursor_init(&zc, os, fromobj);
zap_cursor_retrieve(&zc, &za) == 0;
(void) zap_cursor_advance(&zc)) {
- if (za.za_integer_length != 8 || za.za_num_integers != 1)
- return (SET_ERROR(EINVAL));
+ if (za.za_integer_length != 8 || za.za_num_integers != 1) {
+ err = SET_ERROR(EINVAL);
+ break;
+ }
err = zap_add(os, intoobj, za.za_name,
8, 1, &za.za_first_integer, tx);
if (err)
- return (err);
+ break;
}
zap_cursor_fini(&zc);
- return (0);
+ return (err);
}
int
@@ -1014,18 +1018,21 @@ zap_join_key(objset_t *os, uint64_t fromobj, uint64_t intoobj,
zap_attribute_t za;
int err;
+ err = 0;
for (zap_cursor_init(&zc, os, fromobj);
zap_cursor_retrieve(&zc, &za) == 0;
(void) zap_cursor_advance(&zc)) {
- if (za.za_integer_length != 8 || za.za_num_integers != 1)
- return (SET_ERROR(EINVAL));
+ if (za.za_integer_length != 8 || za.za_num_integers != 1) {
+ err = SET_ERROR(EINVAL);
+ break;
+ }
err = zap_add(os, intoobj, za.za_name,
8, 1, &value, tx);
if (err)
- return (err);
+ break;
}
zap_cursor_fini(&zc);
- return (0);
+ return (err);
}
int
@@ -1036,24 +1043,27 @@ zap_join_increment(objset_t *os, uint64_t fromobj, uint64_t intoobj,
zap_attribute_t za;
int err;
+ err = 0;
for (zap_cursor_init(&zc, os, fromobj);
zap_cursor_retrieve(&zc, &za) == 0;
(void) zap_cursor_advance(&zc)) {
uint64_t delta = 0;
- if (za.za_integer_length != 8 || za.za_num_integers != 1)
- return (SET_ERROR(EINVAL));
+ if (za.za_integer_length != 8 || za.za_num_integers != 1) {
+ err = SET_ERROR(EINVAL);
+ break;
+ }
err = zap_lookup(os, intoobj, za.za_name, 8, 1, &delta);
if (err != 0 && err != ENOENT)
- return (err);
+ break;
delta += za.za_first_integer;
err = zap_update(os, intoobj, za.za_name, 8, 1, &delta, tx);
if (err)
- return (err);
+ break;
}
zap_cursor_fini(&zc);
- return (0);
+ return (err);
}
int