Page MenuHomeFreeBSD

mdmfs(8): Check for other types of helper-program failure
ClosedPublic

Authored by cem on Sep 5 2018, 1:49 AM.

Details

Summary

Exiting with a signal should not be treated the same as successful exit with
zero status.

Return signal exit information to the callers via negative integers, to
enable distinction from normal exit statuses. (All consumers that check for
errors don't care what the exact non-zero exit value is -- in such a case
they print a diagnostic message and either continue or bail.)

Additionally, check for unexpected sources of waitpid() wakeup and bail if
we encounter them.

Reported by: lev@

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

cem created this revision.Sep 5 2018, 1:49 AM
markj accepted this revision.Sep 5 2018, 1:54 AM
markj added inline comments.
sbin/mdmfs/mdmfs.c
680 ↗(On Diff #47677)

The comma isn't needed.

780 ↗(On Diff #47677)

"else" is redundant here. Ditto below.

This revision is now accepted and ready to land.Sep 5 2018, 1:54 AM
cem updated this revision to Diff 47680.Sep 5 2018, 2:08 AM
cem marked 2 inline comments as done.

Thanks!

Removed extraneous comma, 'else's per feedback

This revision now requires review to proceed.Sep 5 2018, 2:08 AM
kib added inline comments.Sep 5 2018, 8:45 AM
sbin/mdmfs/mdmfs.c
434 ↗(On Diff #47680)

It is impossible to understand what is going on seeing an error like

mdconfig exited with error code -9

I think it would be much more useful to check for the negative error and change the message to note a signal.

Same for other run() invocations. Perhaps add a helper ?

cem added inline comments.Sep 5 2018, 2:42 PM
sbin/mdmfs/mdmfs.c
434 ↗(On Diff #47680)

*Shrug* Ok

cem updated this revision to Diff 47697.Sep 5 2018, 3:04 PM

Decode signal return codes from run() more nicely in printed errors.

cem marked 2 inline comments as done.Sep 5 2018, 3:05 PM
lev accepted this revision.Sep 6 2018, 12:56 PM

Looks good.
Thank you!

This revision is now accepted and ready to land.Sep 6 2018, 12:56 PM
kib accepted this revision.Sep 6 2018, 1:28 PM
This revision was automatically updated to reflect the committed changes.