kldunload(8) returns 0, although it fail

From: Alexander Best <arundel_at_freebsd.org>
Date: Tue, 9 Nov 2010 11:46:12 +0000
hi there,

i posted this message on freebsd-questions_at_, but nobody could help me with it.
to me this looks like a bug, so i assume posting it again here on
freebsd-current_at_ might be better.

please keep in mind that the issue here is not the fact that the second attempt
to unload sound.ko/netgraph.ko fails. it *should* fail, because both modules
have dependencies. however it should fail with the first attempt. right now
kldunloadf() returns zero, whereas it should actually return EBUSY (just like
the second attempt).

i've attached two kdump outputs: one for the first 'kldunload' attempt and one
for the second. as you can see the problem is that for some reason kldunloadf()
returns zero, although it couldn't unload the module.

cheers.
alex

----- Forwarded message from Alexander Best <arundel_at_freebsd.org> -----

Date: Fri, 5 Nov 2010 01:15:24 +0000
From: Alexander Best <arundel_at_freebsd.org>
To: freebsd-questions_at_freebsd.org
Subject: Re: kldunload(8) returns 0, although it fail

On Wed Nov  3 10, Alexander Best wrote:
> hi there,
> 
> is this a known issue with kldunload(8)?

this is also very interesting:

***beginn***
otaku% kldstat -v|grep netgraph
 7    3 0xffffffff80bfa000 15e68    netgraph.ko (/boot/kernel/netgraph.ko)
		 6 netgraph
otaku% sudo kldunload netgraph
otaku% echo $?
0
otaku% kldstat -v|grep netgraph
 7    2 0xffffffff80bfa000 15e68    netgraph.ko (/boot/kernel/netgraph.ko)
		 6 netgraph
otaku% 
***end***

there seems to be a logical error in the ref counting code.

cheers.
alex

> 
> ***beginn***
> otaku% kldunload sound
> otaku% echo $?
> 0
> otaku% kldstat
> Id Refs Address            Size     Name
>  1   35 0xffffffff80100000 a2da40   kernel
>  2    1 0xffffffff80b2e000 295e8    snd_hda.ko
>  3    1 0xffffffff80b58000 85110    sound.ko
>  4    1 0xffffffff80bde000 da4bb8   nvidia.ko
>  5    4 0xffffffff81983000 418e0    linux.ko
>  6    1 0xffffffff819c5000 80e8     ng_ubt.ko
>  7    2 0xffffffff819ce000 fa78     ng_hci.ko
>  8    2 0xffffffff819de000 2bd0     ng_bluetooth.ko
>  9    3 0xffffffff819e1000 15e68    netgraph.ko
> 10    1 0xffffffff81c12000 3edb     linprocfs.ko
> 11    3 0xffffffff81c16000 4698     pseudofs.ko
> 12    1 0xffffffff81c1b000 31b3     procfs.ko
> 13    1 0xffffffff81c1f000 a37      linsysfs.ko
> otaku% kldunload sound
> kldunload: attempt to unload file that was loaded by the kernel
> kldunload: can't unload file: Device busy
> otaku% echo $?
> 1
> otaku%
> ***end***
> 
> cheers.
> alex
> 
> -- 
> a13x

-- 
a13x

----- End forwarded message -----

-- 
a13x

Received on Tue Nov 09 2010 - 10:46:12 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:09 UTC