Page MenuHomeFreeBSD

ow_temp: drop the lock around a call that can sleep
ClosedPublic

Authored by avg on Oct 22 2019, 2:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Mar 4, 6:10 PM
Unknown Object (File)
Thu, Feb 27, 4:06 AM
Unknown Object (File)
Wed, Feb 19, 11:29 PM
Unknown Object (File)
Mon, Feb 10, 9:59 AM
Unknown Object (File)
Sun, Feb 9, 1:25 PM
Unknown Object (File)
Sep 19 2024, 2:25 PM
Unknown Object (File)
Sep 15 2024, 1:10 PM
Unknown Object (File)
Sep 8 2024, 10:15 PM
Subscribers
None

Details

Summary

This is similar to what is done around other calls that lead to
own_command_wait() that can sleep.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I'd move the lock to after the if that might do a printf.
Otherwise, this is the right thing to do. We use temp_lock to protect sc->flags only, so this drop doesn't affect that.
In fact, we can go much further than this as noted.
The locking wasn't really attended to when I wrote this driver and I used old-school patterns.

sys/dev/ow/ow_temp.c
148 ↗(On Diff #63538)

I'd move this down 2 lines.

151 ↗(On Diff #63538)

I'd put the lock just before this while() statement.

159 ↗(On Diff #63538)

We can move this lock up to before the for loop.

161 ↗(On Diff #63538)

and then delete this line.

185 ↗(On Diff #63538)

And pick up the lock just before calling msleep.

This revision is now accepted and ready to land.Oct 22 2019, 3:39 PM
This revision was automatically updated to reflect the committed changes.