Fix race condition in SMART
On 11.1-U5, I have identified a drive that is not compatible with smartd (usb drive).
If I go into View Disks, under Storage and check the "Enable S.M.A.R.T." checkbox, I receive an error message in the GUI that states "The service failed to restart.". I have attached a screenshot labelled "enabling_smart.png" showing the message.
This is expected behavior. If I go back into the webUI and UNCHECK the "Enable S.M.A.R.T." checkbox I receive the same "The service failed to restart" message in the webUI. I have attached a screenshot to this ticket laballed "disabling_smart.png" showing this message.
Even though after disabling SMART for the USB drive, the smartd service starts up as usual. The cli shows the smartd process running as normal.
root@truenas:~ # ps -auxwh | grep -v grep | grep smartd root 43394 1.5 0.0 10704 4956 - Ss 09:38 0:00.19 /usr/local/sbin/smartd -n -i 1800 -c /usr/local/etc/smartd.conf -p /var/run/smartd-daemon.pid
fix(service): Fix race condition where StartNotify(verb="restart") reports success
(because pid file exists) before stop command has a chance to remove pid file