Skip to content

Commit

Permalink
7900 zdb shouldn't print the path of a znode entry at verbosity < 5
Browse files Browse the repository at this point in the history
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/zfs#5346
  • Loading branch information
asomers committed Feb 23, 2017
1 parent ad626db commit 5dd6ce2
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions usr/src/cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1702,23 +1702,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));
Expand Down

0 comments on commit 5dd6ce2

Please sign in to comment.