Date: Sun, 30 May 2021 22:21:35 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 27006229f7a4 - main - vinvalbuf: do not panic if we were unable to flush dirty buffers Message-ID: <202105302221.14UMLZwS066030@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=27006229f7a40a18a61a0e8fd270bc583326b690 commit 27006229f7a40a18a61a0e8fd270bc583326b690 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-05-30 16:52:42 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-05-30 22:20:53 +0000 vinvalbuf: do not panic if we were unable to flush dirty buffers Return EBUSY instead and let caller to handle the issue. For vgone()/vnode reclamation, caller first does vinvalbuf(V_SAVE), which return EBUSY in case dirty buffers where not flushed. Then caller calls vinvalbuf(0) due to non-zero return, which gets rid of all dirty buffers without dependencies. PR: 238565 Reviewed by: asomers, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30555 --- sys/kern/vfs_subr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 7c9604457aef..ad0f1c2a0c7c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2032,13 +2032,11 @@ bufobj_invalbuf(struct bufobj *bo, int flags, int slpflag, int slptimeo) } while (error == ERELOOKUP); if (error != 0) return (error); - /* - * XXX We could save a lock/unlock if this was only - * enabled under INVARIANTS - */ BO_LOCK(bo); - if (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0) - panic("vinvalbuf: dirty bufs"); + if (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0) { + BO_UNLOCK(bo); + return (EBUSY); + } } } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105302221.14UMLZwS066030>