Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jan 2003 13:25:59 +0100
From:      phk@freebsd.org
To:        ticso@cicely.de
Cc:        Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de>, freebsd-current@freebsd.org
Subject:   Re: I want a sysctl kern.allow_shooting_into_my_foot! 
Message-ID:  <25074.1043238359@critter.freebsd.dk>
In-Reply-To: Your message of "Wed, 22 Jan 2003 13:17:39 %2B0100." <20030122121739.GA758@cicely8.cicely.de> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20030122121739.GA758@cicely8.cicely.de>, Bernd Walter writes:
>On Tue, Jan 21, 2003 at 11:06:05PM +0100, phk@FreeBSD.ORG wrote:
>> In message <20030121225940.G37868@uriah.heep.sax.de>, Joerg Wunsch writes:
>> >As phk@freebsd.org wrote:
>> >
>> >> Hang on.
>> >> 
>> >> If no disk partitions of any kind are open, there is nothing which
>> >> prevents you from doing a "dd if=/dev/zero of=/dev/da0 bs=64k".
>> >
>> >My guess is that vinum scanned the disks when starting, but found
>> >nothing on it.
>> 
>> And forgot to close them again ?  Well, you know where to look
>> for that bug then :-)
>> 
>> (If you look in the "sysctl -b kern.geom.confxml" output, you will
>> be able to see the read/write/exclusive open counts, look for
>> "r%dw%de%d" strings.)
>
>Interesting sysctl.

Yes, one of the more informative :-)

>        <provider id="0xc2c4c800">
>          <geom ref="0xc2c4d300"/>
>          <mode>r1w1e0</mode>
>          <name>da13e</name>
>          <mediasize>652329984</mediasize>
>          <sectorsize>1024</sectorsize>
>          <config>
>            <index>4</index>
>            <length>652329984</length>
>            <seclength>1274082</seclength>
>            <offset>0</offset>
>            <secoffset>0</secoffset>
>          </config>
>        </provider>
>    </geom>

>If I got it right it tells me, that da13e is opened for read/write.

You can also try this, it's more easily informative:

	sysctl -n kern.geom.confdot | dot -Tps > _.ps ; gv _.ps

You need the graphviz and ghostscript ports for this.

>I never complained about this, because the system is rather old
>(2002-11-15) and I believed it was already fixed.
>But it sounds like Joergs situation may be triggered by the same bug.
>Mmmm - I'm using vinum too.
>Is there any way to find out which ones open it was?

Hmm, since this happens during boot, you cannot set the debug flag
with sysctl in time, so you have to compile a custom kernel for it:

in sys/geom/geom_kern.c change:

	int g_debugflags;

to
	int g_debugflags = G_T_ACCESS;

and recompile + reboot.

This will make GEOM printf all "access" (ie: open/close) changes and
you should hopefully be able to deduce where the open of your MO comes
from.

If this is not enough, you can try to set

	int g_debugflags = G_T_ACCESS | G_T_TOPOLOGY;

But that will result in much more debugging output.

You can turn this debugging off from userland with:
	sysctl kern.geom.debugflags=0

Poul-Henning

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk@FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

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?25074.1043238359>