diff options
author | Tim Chase <[email protected]> | 2015-02-02 23:55:20 -0600 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-02-04 16:35:26 -0800 |
commit | aa2ef419e46b3ad7c2ad8848b7a308a5a949aba7 (patch) | |
tree | dbe5b450c269fd2d8bcdf6b052611fd80fca9b2d /module/zfs | |
parent | 037763e44e0f6d7284e9328db988a89fdc975a4e (diff) |
Spurious ENOMEM returns when reading dbufs kstat
Commit 7b2d78a046aa4695d434478a439a9438521d73af fixed some improper uses
of snprintf(), however, in __dbuf_stats_hash_table_data() the return
value of snprintf is propagated to the caller. This caused spurious
ENOMEM errors when reading the dbufs kstat.
This commit causes the actual number of characters written to be returned.
Signed-off-by: Tim Chase <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #3072
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/dbuf_stats.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/module/zfs/dbuf_stats.c b/module/zfs/dbuf_stats.c index 0e4c18ed7..3b9c63d31 100644 --- a/module/zfs/dbuf_stats.c +++ b/module/zfs/dbuf_stats.c @@ -67,6 +67,7 @@ __dbuf_stats_hash_table_data(char *buf, size_t size, dmu_buf_impl_t *db) arc_buf_info_t abi = { 0 }; dmu_object_info_t doi = { 0 }; dnode_t *dn = DB_DNODE(db); + size_t nwritten; if (db->db_buf) arc_buf_info(db->db_buf, &abi, zfs_dbuf_state_index); @@ -74,7 +75,7 @@ __dbuf_stats_hash_table_data(char *buf, size_t size, dmu_buf_impl_t *db) if (dn) __dmu_object_info_from_dnode(dn, &doi); - (void) snprintf(buf, size, + nwritten = snprintf(buf, size, "%-16s %-8llu %-8lld %-8lld %-8lld %-8llu %-8llu %-5d %-5d %-5lu | " "%-5d %-5d %-6lld 0x%-6x %-6lu %-8llu %-12llu " "%-6lu %-6lu %-6lu %-6lu %-6lu %-8llu %-8llu %-8d %-5lu | " @@ -118,7 +119,10 @@ __dbuf_stats_hash_table_data(char *buf, size_t size, dmu_buf_impl_t *db) (u_longlong_t)doi.doi_fill_count, (u_longlong_t)doi.doi_max_offset); - return (size); + if (nwritten >= size) + return (size); + + return (nwritten + 1); } static int |