[Bug 238565] panic: vinvalbuf: dirty bufs during unmount if clustered writes return errors

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 29 May 2021 23:29:51 +0000
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238565

--- Comment #9 from Konstantin Belousov <kib_at_FreeBSD.org> ---
(In reply to Kirk McKusick from comment #8)
> I am confused as to why the EIO error is not being returned. Presumably in bufobj_invalbuf() we attempt to do the write in the call to BO_SYNC(). If BO_SYNC() returns EIO, we should return it rather than falling through to the panic. So how is it that the EIO is not returned?

BO_SYNC() does not see any error.  Default implementation of BO_SYNC() is
bufsync()
which is just redirection to VOP_FSYNC().  And default implementation of
vop_fsync
for filesystems using buffer cache is vn_fsync_buf(), which does bawrite()
(non-clustered) or vfs_bio_awrite() (clustered).  In either case, the real
action occurs in bufdone()->brelse() occuring on write completion.  Look at
the conditional with the inner comment 'Failed write, redirty.'  It does
exactly
that: if the async write failed, the buffer is redirtied and re-inserted into
the
dirty list.

After several loops where the dirty buffer is found/awritten/redirtied, fsync
eventually gives up, and vinvalbuf() gets the control back to find the dirty
buffer on the list and panic.

-- 
You are receiving this mail because:
You are the assignee for the bug.
Received on Sat May 29 2021 - 23:29:51 UTC

Original text of this message