Index: dev/ata/wd.c =================================================================== RCS file: /cvsroot/src/sys/dev/ata/wd.c,v retrieving revision 1.438 diff -u -p -r1.438 wd.c --- dev/ata/wd.c 7 Jan 2018 11:37:30 -0000 1.438 +++ dev/ata/wd.c 16 Apr 2018 22:34:24 -0000 @@ -765,6 +765,8 @@ wdstart(device_t self) if (!device_is_active(dksc->sc_dev)) return; + mutex_enter(&wd->sc_lock); + /* * Do not queue any transfers until flush is finished, so that * once flush is pending, it will get handled as soon as xfer @@ -773,9 +775,12 @@ wdstart(device_t self) if (ISSET(wd->sc_flags, WDF_FLUSH_PEND)) { ATADEBUG_PRINT(("wdstart %s flush pend\n", dksc->sc_xname), DEBUG_XFERS); + mutex_exit(&wd->sc_lock); return; } + mutex_exit(&wd->sc_lock); + dk_start(dksc, NULL); }