freebsd-update and hang during reboot

Kurt Lidl lidl at pix.net
Mon Feb 9 21:29:13 UTC 2015


Ian Lepore wrote:

>> I ran into this problem in spades when upgrading a set of servers from
>> FreeBSD 9.0 to 9.1.  I happened consistently.  Normal reboots worked,
>> but when going from 9.0 to 9.1, it *ALWAYS* hung, and it always hung
>> at the same place, after printing the "All buffers synced" message.
>>
>> I ultimately determined that if I did the following, rather than
>> just a "reboot" or "shutdown -r now 'FreeBSD 9.1-RELEASE upgrade'",
>> it would consistently AVOID the hang:
>>
>> sync ; sync ; sync ; shutdown -o -n -r now "FreeBSD 9.1 install"
>>
>> Your mileage may vary, but you don't have a lot to lose by trying it.
>>
>> -Kurt
>>
>
> That is just bad advice.  sync(1) does not g'tee that all data has been
> written, no matter how many times you type it.  shutdown -n tells the
> system to abandon unwritten data.  All in all, this is a recipe for
> silent filesystem corruption.  Using it after an update is just asking
> to have a mix of old and new files on the system after the reboot.

I didn't specify that I was using ZFS, but I was.  And this comment in
the ZFS code (zfs_vfsops.c, line 170):

/*
  * Sync all ZFS filesystems.  This is what happens when you
  * run sync(1M).  Unlike other filesystems, ZFS honors the
  * request by waiting for all pools to commit all dirty data.
  */
spa_sync_allpools();

Says that sync() won't return until the dirty data is flushed.
For my use case, I believe it was perfectly safe.


-Kurt




More information about the freebsd-stable mailing list