Skip to contentSkip to conversation

latency logging with file operation IO engines

DISCUSSION Vincent Fu 2 participants 2 messages Sep 5, 2024 – Sep 6, 2024

lore
Share & tools
lore

Vincent Fu

author
#0 lore raw

Hello Shin'ichiro,

Coverity reported the issue below with the "stat: reduce arguments of add_log_sample()" commit.

** CID 509196: Null pointer dereferences (FORWARD_NULL)

________________________________________________________________________________________________________
*** CID 509196: Null pointer dereferences (FORWARD_NULL) /stat.c: 3342 in add_clat_sample()

3336     	 */
3337     	if (!ts->lat_percentiles)
3338     		add_stat_prio_sample(ts->clat_prio[ddir], clat_prio_index,
3339     				     nsec);

3340
3341 if (td->clat_log) {

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 509196: Null pointer dereferences (FORWARD_NULL)
Passing null pointer "&io_u->issue_time" to "ntime_since", which dereferences it.

3342     		struct log_sample sample = { sample_val(nsec), ddir, bs,
3343     			offset, ioprio,
3344     			ntime_since(&td->epoch, &io_u->issue_time) };

3345
3346 add_log_sample(td, td->clat_log, &sample);
3347 }

It appears that with the refactoring it is no longer possible to carry out latency logging with the file operation ioengines since their calls set io_u to NULL. Would you be able to devise a way to restore this?

Vincent

#1 lore raw
Quoted 4 lines · Vincent Fu

Hello Shin'ichiro,

Coverity reported the issue below with the "stat: reduce arguments of add_log_sample()" commit.

Hello Vincent, thank you for finding out the failure. I looked in the detail, and found my commit 14d3134a5fc0 ("introduce the log_issue_time option") triggered the failure.

Quoted 18 lines

** CID 509196: Null pointer dereferences (FORWARD_NULL)

________________________________________________________________________________________________________
*** CID 509196: Null pointer dereferences (FORWARD_NULL) /stat.c: 3342 in add_clat_sample()

3336     	 */
3337     	if (!ts->lat_percentiles)
3338     		add_stat_prio_sample(ts->clat_prio[ddir], clat_prio_index,
3339     				     nsec);

3340
3341 if (td->clat_log) {

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

CID 509196: Null pointer dereferences (FORWARD_NULL) Passing null pointer "&io_u->issue_time" to "ntime_since", which

dereferences it.

3342     		struct log_sample sample = { sample_val(nsec), ddir, bs,
3343     			offset, ioprio,
3344     			ntime_since(&td->epoch, &io_u->issue_time) };
Quoted 7 lines

3345
3346 add_log_sample(td, td->clat_log, &sample);
3347 }

It appears that with the refactoring it is no longer possible to carry out latency logging with the file operation ioengines since their calls set io_u to NULL. Would you be able to devise a way to restore this?

Sorry for the trouble. Will post fix patches soon.