Thread: OpenBSD Sync disks in a better way
View Single Post
  #2   (View Single Post)  
Old 6th January 2018
e1-531g e1-531g is offline
VPN Cryptographer
 
Join Date: Mar 2014
Posts: 448
Default

FFS should become even more rock solid.

https://marc.info/?l=openbsd-tech&m=151526338730514&w=2
Subject: clean on-disk filesystems through {suspend,hibernate}/resume
From: Theo de Raadt <deraadt () openbsd ! org>

Quote:
I've been working for about a month to ensure filesystems are
maximally syncronized and/or clean on-disk through a suspend/resume
cycle.

The idea is if a suspend/resume or hibernate/resume sequence gets
broken (by pulling the power+battery during suspend, or similar
circumstances during the hiberate-write sequence), we can be assured
that the filesystems are in the best shape. And if done correctly,
we'll even have marked-clean filesystems which don't need a fsck, so
that fresh boot is faster.

There is also a similar case when softraid (layers) underly the
filesystems. These layers need proper syncronization to disk also.

Previously we've been ignoring this issue, and frankly we've done
mostly fine...

The changes starts with a series of changes to suspend. It is a bit
tricky to syncronize the in-memory soft-state of the fileystems to
disk, and block new in-memory changes from happening.

New allocations of vnodes are caused to sleep-spin, so that other
processes cannot advance creating new files. All mountpoints are told
to non-lazy sync their filesystems and locks are held on these
mountpoints so that no new activity can occur. During this phase, the
number of dangling inodes (nlink == 0) is counted, and if any are
found the on-disk filesystem is marked dirty, otherwise marked clean.
Next, softraid can be told to save it's state, but it uses vnodes so a
hack allows it to bypass the sleep-spin mentioned earlier. Once the
suspend code knows there are no more tsleep, it can unwind the mount
locks so there is less to worry about upon resume.

I would appreciate reports, and later I'll cut this into pieces and
commit incremental changes.
__________________
Signature: Furthermore, I consider that systemd must be destroyed.
Based on Latin oratorical phrase
Reply With Quote