summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2000-07-04 03:23:29 +0000
committermckusick <mckusick@FreeBSD.org>2000-07-04 03:23:29 +0000
commit806786489f486969418422381048f277d86e0a20 (patch)
treeff3e94c78ea027cfa996b05917da899feefaa5cf /sys
parent7d89e4553988d8aade4ed98d794ad24c21c09b52 (diff)
downloadFreeBSD-src-806786489f486969418422381048f277d86e0a20.zip
FreeBSD-src-806786489f486969418422381048f277d86e0a20.tar.gz
If a buffer flush fails when trying to reclaim a vnode, it is too
late to save the vnode, so just toss any remaining unwritten buffers rather than leaving them lying around to make trouble in the future.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_export.c14
-rw-r--r--sys/kern/vfs_subr.c14
2 files changed, 20 insertions, 8 deletions
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index 684bcd4..fa6e117 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -1660,14 +1660,20 @@ vclean(vp, flags, p)
/*
* Clean out any buffers associated with the vnode.
+ * If the flush fails, just toss the buffers.
*/
- vinvalbuf(vp, V_SAVE, NOCRED, p, 0, 0);
+ if (flags & DOCLOSE) {
+ if (vinvalbuf(vp, V_SAVE, NOCRED, p, 0, 0) != 0)
+ vinvalbuf(vp, 0, NOCRED, p, 0, 0);
+ }
+
if ((obj = vp->v_object) != NULL) {
if (obj->ref_count == 0) {
/*
- * vclean() may be called twice. The first time removes the
- * primary reference to the object, the second time goes
- * one further and is a special-case to terminate the object.
+ * vclean() may be called twice. The first time
+ * removes the primary reference to the object,
+ * the second time goes one further and is a
+ * special-case to terminate the object.
*/
vm_object_terminate(obj);
} else {
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 684bcd4..fa6e117 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1660,14 +1660,20 @@ vclean(vp, flags, p)
/*
* Clean out any buffers associated with the vnode.
+ * If the flush fails, just toss the buffers.
*/
- vinvalbuf(vp, V_SAVE, NOCRED, p, 0, 0);
+ if (flags & DOCLOSE) {
+ if (vinvalbuf(vp, V_SAVE, NOCRED, p, 0, 0) != 0)
+ vinvalbuf(vp, 0, NOCRED, p, 0, 0);
+ }
+
if ((obj = vp->v_object) != NULL) {
if (obj->ref_count == 0) {
/*
- * vclean() may be called twice. The first time removes the
- * primary reference to the object, the second time goes
- * one further and is a special-case to terminate the object.
+ * vclean() may be called twice. The first time
+ * removes the primary reference to the object,
+ * the second time goes one further and is a
+ * special-case to terminate the object.
*/
vm_object_terminate(obj);
} else {
OpenPOWER on IntegriCloud