Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Dec 2001 11:05:22 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Josef Karthauser <joe@tao.org.uk>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/kern vfs_subr.c vfs_vnops.c src/sys/sys vnode.h
Message-ID:  <200112191905.fBJJ5M190050@apollo.backplane.com>
References:  <200112182048.fBIKmsw61056@freefall.freebsd.org> <20011218233427.C412@tao.org.uk> <200112190103.fBJ134885760@apollo.backplane.com> <20011219010928.A3769@tao.org.uk> <200112190118.fBJ1IZQ85907@apollo.backplane.com> <20011219012344.A4024@tao.org.uk> <200112190802.fBJ82n387037@apollo.backplane.com> <20011219183715.A9679@tao.org.uk>

next in thread | previous in thread | raw e-mail | index | archive | help

:>     hmm.. ok, there are some subsystems using sbuf's:
:>=20
:> 	linprocfs
:> 	procfs
:> 	pseudofs
:>=20
:>     I think someone may have broken something in pseudofs, procfs,
:>     and/or linprocfs that is causing the VFS cache and sbuf MALLOC
:>     area to run away.
:>=20
:>     Anybody have any ideas?
:
:This certainly appear to be the case.  I've unmounted procfs and
:linprocfs and I've got an uptime of 5 hours now.  Result! :)
:
:Joe

    Excellent!  Can you narrow the problem down further, to either procfs or
    linprocfs?

    I think I *may* have found it.  Or at least I've found one error.  There
    could be more:

void
sbuf_delete(struct sbuf *s)
{
        assert_sbuf_integrity(s);
        /* don't care if it's finished or not */
       
        if (SBUF_ISDYNAMIC(s))
                SBFREE(s->s_buf);
        bzero(s, sizeof *s);
        if (SBUF_ISDYNSTRUCT(s))
                SBFREE(s);
}

    The structure is being bzero()'d before its dynamic flag gets checked.
    I've included a patch below.  Josef, I would appreciate it if you would
    apply the patch and try your system with the various procfs devices
    mounted again.  It's an obvious bug so I'm comitting it to -current now,
    the question is:  Is it the *only* bug?

						-Matt

Index: kern/subr_sbuf.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/subr_sbuf.c,v
retrieving revision 1.13
diff -u -r1.13 subr_sbuf.c
--- kern/subr_sbuf.c	10 Dec 2001 05:51:45 -0000	1.13
+++ kern/subr_sbuf.c	19 Dec 2001 19:01:26 -0000
@@ -461,12 +461,15 @@
 void
 sbuf_delete(struct sbuf *s)
 {
+	int isdyn;
+
 	assert_sbuf_integrity(s);
 	/* don't care if it's finished or not */
 	
 	if (SBUF_ISDYNAMIC(s))
 		SBFREE(s->s_buf);
+	isdyn = SBUF_ISDYNSTRUCT(s);
 	bzero(s, sizeof *s);
-	if (SBUF_ISDYNSTRUCT(s))
+	if (isdyn)
 		SBFREE(s);
 }

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112191905.fBJJ5M190050>