From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Snitzer Subject: Re: dm-bufio Date: Fri, 23 Mar 2012 10:32:55 -0400 Message-ID: <20120323143254.GG7220@redhat.com> References: <4F6C5A1F.1000103@redhat.com> <20120323142133.GF7220@redhat.com> Reply-To: device-mapper development Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: "Kasatkin, Dmitry" Cc: device-mapper development , mpatocka@redhat.com, Zdenek Kabelac List-Id: dm-devel.ids On Fri, Mar 23 2012 at 10:29am -0400, Kasatkin, Dmitry wrote: > On Fri, Mar 23, 2012 at 4:21 PM, Mike Snitzer wrote: > > On Fri, Mar 23 2012 at 10:12am -0400, > > Kasatkin, Dmitry wrote: > > > >> On Fri, Mar 23, 2012 at 1:26 PM, Kasatkin, Dmitry > >> wrote: > >> > On Fri, Mar 23, 2012 at 1:10 PM, Zdenek Kabelac 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 d= irty > >> >>> buffers are written to the storage when machine reboots? > >> >>> suspend hooks could be used, but they are not called on reboot, on= ly > >> >>> when suspending/removing the target... > >> >>> > >> >> > >> >> You mean you reboot without running =A0'sync' command? > >> >> > >> >> And yes - on reboot you should properly unmount devices - so you sh= ould > >> >> see removal of target on your shutdown sequence - =A0I believe Fedo= ra 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 dat= a. > >> > 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 > >> > >> =A0 =A0 =A0 dm_bufio_write_dirty_buffers(d->bufio); > >> =A0 =A0 =A0 sync_blockdev(d->dev->bdev); > >> =A0 =A0 =A0 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. > > > = > The target contains rootfs... On reboot, it is remounted read-only. > I cannot remove it... > = > Sometime ago I had "message" operation "sync", to sync backing devices. > But reboot notifier looks nice... It is automatically called. OK. As an aside, just curious: what does your target do?