stat: fix --bandwidth-log segfault
PATCH 1/1 stat: fix --bandwidth-log segfault
Since bandwidth log has no corresponding thread data and pending struct, we cannot access any fields inside it.
Signed-off-by Igor Konopko <[email protected]>
--- stat.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
stat.c +5 -3
@@ -2212,12 +2212,14 @@ static struct io_logs *get_cur_log(struct io_log *iolog)* submissions, flag 'td' as needing a log regrow and we'll take * care of it on the submission side. */ -if (iolog->td->o.io_submit_mode ==IO_MODE_OFFLOAD || +if ((iolog->td && iolog->td->o.io_submit_mode ==IO_MODE_OFFLOAD ) || !per_unit_log (iolog))return regrow_log (iolog); - iolog->td->flags |=TD_F_REGROW_LOGS ; -assert (iolog->pending->nr_samples < iolog->pending->max_samples); +if (iolog->td) + iolog->td->flags |=TD_F_REGROW_LOGS ; +if (iolog->pending) +assert (iolog->pending->nr_samples < iolog->pending->max_samples);return iolog->pending; }
Signature · 1 line
2.14.3
Quoted 2 lines · Igor Konopko
Since bandwidth log has no corresponding thread data and pending struct, we cannot access any fields inside it.
Thanks Igor, applied.
Signature · 1 line
Jens Axboe