Go back to using sbuf_new() with a preallocated large buffer, to avoid

triggering an sbuf auto-drain copyout while holding a lock.

Pointed out by:	   jhb
Pointy hat: 	   ian
This commit is contained in:
Ian Lepore 2015-03-14 23:57:33 +00:00
parent 2a6a72f113
commit dcdeb95f09
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=280014

View File

@ -604,7 +604,8 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS)
char ip6buf[INET6_ADDRSTRLEN];
#endif
sbuf_new_for_sysctl(&sb, NULL, linesize, req);
sbuf_new(&sb, NULL, linesize * (V_tcp_hostcache.cache_count + 1),
SBUF_INCLUDENUL);
sbuf_printf(&sb,
"\nIP address MTU SSTRESH RTT RTTVAR BANDWIDTH "
@ -642,6 +643,8 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS)
}
#undef msec
error = sbuf_finish(&sb);
if (error == 0)
error = SYSCTL_OUT(req, sbuf_data(&sb), sbuf_len(&sb));
sbuf_delete(&sb);
return(error);
}