Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Dec 2011 09:11:43 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-hackers@freebsd.org
Cc:        hackers@freebsd.org, Andriy Gapon <avg@freebsd.org>
Subject:   Re: RB_NOSYNC -> no device_shutdown ?
Message-ID:  <201112200911.43880.jhb@freebsd.org>
In-Reply-To: <4EED20C7.1090704@FreeBSD.org>
References:  <4EED20C7.1090704@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday, December 17, 2011 6:07:51 pm Andriy Gapon wrote:
> 
> I look at the following code:
> 
> static void
> module_init(void *arg)
> {
> 
>         sx_init(&modules_sx, "module subsystem sx lock");
>         TAILQ_INIT(&modules);
>         EVENTHANDLER_REGISTER(shutdown_final, module_shutdown, NULL,
>             SHUTDOWN_PRI_DEFAULT);
> }
> 
> SYSINIT(module, SI_SUB_KLD, SI_ORDER_FIRST, module_init, 0);
> 
> static void
> module_shutdown(void *arg1, int arg2)
> {
>         module_t mod;
> 
>         if (arg2 & RB_NOSYNC)
>                 return;
>         mtx_lock(&Giant);
>         MOD_SLOCK;
>         TAILQ_FOREACH_REVERSE(mod, &modules, modulelist, link)
>                 MOD_EVENT(mod, MOD_SHUTDOWN);
>         MOD_SUNLOCK;
>         mtx_unlock(&Giant);
> }
> 
> and wonder why RB_NOSYNC is overloaded to mean that no
> MOD_SHUTDOWN/device_shutdown cleanup should be done?

Presumably most device_shutdown handlers were used for syncing storage when 
the module stuff was first added.  I'm not sure how you would fix this now 
since you can't easily pass the 'arg2' flags down to each handler so that the 
appropriate ones could skip their shutdown actions.

-- 
John Baldwin



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