]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
When the journaled FFS volume is suspended due to the journal space
authorKonstantin Belousov <kib@FreeBSD.org>
Wed, 20 Mar 2013 21:07:49 +0000 (21:07 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Wed, 20 Mar 2013 21:07:49 +0000 (21:07 +0000)
commit8d6884ce9ce263975ef442de5d259c1bf9588a05
treeb70af796e14ffb314315311c8bff02276a3d09e0
parent3289d5877a321a6e073875da5a1ab374f50fbbff
When the journaled FFS volume is suspended due to the journal space
becoming too low, the softdep flush thread processes the workitems,
which frees the space in journal, and then unsuspends the fs.  The
softdep_flush() and other workitem processing functions busy the
filesystem before iterating over the worklist, to prevent the parallel
unmount from freeing the mount data. The vfs_busy() is called with
MBF_NOWAIT flag.

Now, if the unmount is already started and the filesystem is suspended
due to low journal space, the journal is never flushed and filesystem
is never unsuspended, because vfs_busy(MBF_NOWAIT) call cannot succeed
for the unmounting fs, and softdep_flush() does not process the
workitems. Unmount needs to write metadata, where it hangs in the
"suspfs" state.

Move the vn_start_write() call in the dounmount() before setting the
MNTK_UNMOUNT flag. This practically ensures that softdep_flush()
processed the pending journal writes by making dounmount() wait for
the lift of the suspension.

Sponsored by: The FreeBSD Foundation
Reported and tested by: pho
MFC after: 2 weeks
sys/kern/vfs_mount.c