snitzer at redhat.com
Fri Mar 23 14:21:33 UTC 2012
On Fri, Mar 23 2012 at 10:12am -0400,
Kasatkin, Dmitry <dmitry.kasatkin at intel.com> wrote:
> On Fri, Mar 23, 2012 at 1:26 PM, Kasatkin, Dmitry
> <dmitry.kasatkin at intel.com> wrote:
> > On Fri, Mar 23, 2012 at 1:10 PM, Zdenek Kabelac <zkabelac at redhat.com> wrote:
> >> Dne 23.3.2012 12:01, Kasatkin, Dmitry napsal(a):
> >>> Hello,
> >>> When using dm-bufio and dm-io in general, how to ensure that all dirty
> >>> buffers are written to the storage when machine reboots?
> >>> suspend hooks could be used, but they are not called on reboot, only
> >>> when suspending/removing the target...
> >> You mean you reboot without running 'sync' command?
> >> And yes - on reboot you should properly unmount devices - so you should
> >> see removal of target on your shutdown sequence - I believe Fedora currently
> >> tries to support switch to some shutdown ramdisk, so all filesystem and
> >> devices might be properly unmounted and destroyed.
> > Hello,
> > Thanks for response.
> > I use bufio to store some data on block device.
> > It is not mounted in anyway. My target just use it to load/store data.
> > When machine reboots, I want to be sure that bufio written all dirty buffers...
> > - Dmitry
> At the moment, I have reboot notifier which does the following
> blkdev_issue_flush(d->dev->bdev, GFP_KERNEL, NULL);
> without first line on the next boot I got corrupted/not updated blocks.
> and I am not sure if I need last 2 lines...
Are you cleanly removing the target from the kernel before reboot
(e.g. dmsetup remove devname)?
As long as your target's .dtr is making sure to flush all outstanding IO
(like your reboot notifier does) you should be fine.
More information about the dm-devel