diff options
author | kib <kib@FreeBSD.org> | 2013-07-09 20:49:32 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2013-07-09 20:49:32 +0000 |
commit | a7b76b76e17881d47ffd2715135b3512e07d0fbf (patch) | |
tree | 163763327fb3a8dbae9807ce2cbea1c3bb9f69f6 /sys/geom | |
parent | 247743cbbaf231a82a50f74ca849e50b747d1401 (diff) | |
download | FreeBSD-src-a7b76b76e17881d47ffd2715135b3512e07d0fbf.zip FreeBSD-src-a7b76b76e17881d47ffd2715135b3512e07d0fbf.tar.gz |
There are several code sequences like
vfs_busy(mp);
vfs_write_suspend(mp);
which are problematic if other thread starts unmount between two
calls. The unmount starts a write, while vfs_write_suspend() drain
writers. On the other hand, unmount drains busy references, causing
the deadlock.
Add a flag argument to vfs_write_suspend and require the callers of it
to specify VS_SKIP_UNMOUNT flag, when the call is performed not in the
mount path, i.e. the covered vnode is not locked. The suspension is
not attempted if VS_SKIP_UNMOUNT is specified and unmount is in
progress.
Reported and tested by: Andreas Longwitz <longwitz@incore.de>
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/journal/g_journal.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c index a3c996c..3ce2785 100644 --- a/sys/geom/journal/g_journal.c +++ b/sys/geom/journal/g_journal.c @@ -2960,7 +2960,7 @@ g_journal_do_switch(struct g_class *classp) GJ_TIMER_STOP(1, &bt, "BIO_FLUSH time of %s", sc->sc_name); GJ_TIMER_START(1, &bt); - error = vfs_write_suspend(mp); + error = vfs_write_suspend(mp, VS_SKIP_UNMOUNT); GJ_TIMER_STOP(1, &bt, "Suspend time of %s", mountpoint); if (error != 0) { GJ_DEBUG(0, "Cannot suspend file system %s (error=%d).", |