Subject: Re: [RFC] doshutdownhooks() and friends.
To: Cherry G.Mathew <cherry.g.mathew@gmail.com>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 07/27/2006 08:11:40
On Jul 26, 2006, at 9:36 PM, Cherry G. Mathew wrote:

> On 4/22/06, Cherry G. Mathew <cherry@zyx.in> wrote:
>> Hi,
>>
>> This patch will re-work the doshutdownhooks() call, to pass a  
>> variable
>> indicating the nature of the shutdown; ie;
>>

Thinking about this, if we are going to rework this calls, then we
should do it right.  Most shutdownhooks should be also used in causing
devices and filesystems to quiesce before sleeping.

shutdownhooks should go away.  instead we should have a two stage
process and, for devices, this should be using ca_activate in
struct cfattach.  For filesystems, we should add a vfs_activate
to struct vfsops.

     (*wdc_ca.ca_activate)(wdc_cd.cd_devs[0], DVACT_DEACTIVATE_PREPARE);

Ask the device to prepare to quiesce, it returns 0 if it is ready or
an errno if it's not possible.  If it returns EAGAIN, call with PREPARE
again after deactivating next device.  If at the end of the device list
and there are devices returning EAGAIN, either panic or fail the  
PREPARE.

Now depending on results of the PREPARE, either call the ca_activate  
with
DVACT_DEACTIVATE_COMMIT (now really quiesce) or DVACT_DEACTIVATE_CANCEL
(resume normal operation).  COMMIT and CANCEL not allowed to fail.