aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorAlan Somers <[email protected]>2017-04-13 14:22:32 -0700
committerBrian Behlendorf <[email protected]>2017-04-14 11:11:28 -0700
commita5c3a1efaf8a47b0988a27ae429c4b28467abae3 (patch)
treee9f269a6270bf1e0d6733d88ad034958d13eb2d3 /cmd
parent87a275d97aa5b7bb47c0601c8b005e8ae85be2f7 (diff)
OpenZFS 7900 - zdb shouldn't print the path of a znode at verbosity < 5
Authored by: Alan Somers <[email protected]> Approved by: Dan McDonald <[email protected]> Reviewed by: Paul Dagnelie <[email protected]> Reviewed by: Matt Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: Giuseppe Di Natale <[email protected]> There are two reasons: 1) Finding a znode's path is slower than printing any other znode information at verbosity < 5. 2) On a corrupted pool like the one mentioned below, zdb will crash when it tries to determine the znode's path. But with this patch, zdb can still extract useful information from such pools. OpenZFS-issue: https://www.illumos.org/issues/7900 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/2b0dee1 Closes #6016
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zdb/zdb.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index 13d0bcf0e..e8672c836 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -1824,23 +1824,19 @@ dump_znode(objset_t *os, uint64_t object, void *data, size_t size)
return;
}
- error = zfs_obj_to_path(os, object, path, sizeof (path));
- if (error != 0) {
- (void) snprintf(path, sizeof (path), "\?\?\?<object#%llu>",
- (u_longlong_t)object);
- }
- if (dump_opt['d'] < 3) {
- (void) printf("\t%s\n", path);
- (void) sa_handle_destroy(hdl);
- return;
- }
-
z_crtime = (time_t)crtm[0];
z_atime = (time_t)acctm[0];
z_mtime = (time_t)modtm[0];
z_ctime = (time_t)chgtm[0];
- (void) printf("\tpath %s\n", path);
+ if (dump_opt['d'] > 4) {
+ error = zfs_obj_to_path(os, object, path, sizeof (path));
+ if (error != 0) {
+ (void) snprintf(path, sizeof (path),
+ "\?\?\?<object#%llu>", (u_longlong_t)object);
+ }
+ (void) printf("\tpath %s\n", path);
+ }
dump_uidgid(os, uid, gid);
(void) printf("\tatime %s", ctime(&z_atime));
(void) printf("\tmtime %s", ctime(&z_mtime));