grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hostdisk: Fix linux disk cache workaround on multipath disks


From: Michael Chang
Subject: Re: [PATCH] hostdisk: Fix linux disk cache workaround on multipath disks
Date: Wed, 12 Sep 2018 16:27:23 +0800
User-agent: NeoMutt/20170421 (1.8.2)

On Tue, Sep 04, 2018 at 04:46:31PM +0200, Daniel Kiper wrote:
> On Wed, Jul 25, 2018 at 04:49:15PM +0800, Michael Chang wrote:
> > In hostdisk.c::grub_util_fd_open_device, there's a workaround to linux disk
> 
> s#hostdisk.c::grub_util_fd_open_device#grub-core/osdep/linux/hostdisk.c:grub_util_fd_open_device()#

OK.

> 
> > cache described below.
> >
> > "Linux has a bug that the disk cache for a whole disk is not consistent with
> > the one for a partition of the disk."
> >
> > The workaround will result in using the partition device for writing the 
> > image
> 
> Which workaround are you referring to?

There's a comment in
grub-core/osdep/linux/hostdisk.c::grub_util_fd_open_device() that stats "Linux
has a bug ..." that we cannot use whole disk offset writing into a partition
device since it does not reliably work that the data may be lost.

  /* Linux has a bug that the disk cache for a whole disk is not consistent
     with the one for a partition of the disk.  */
  {
    ....
  } 

And as the input argument of grub_util_fd_open_device() is using address in
unit of sector size offset from the "disk", and in a bid to avoid Linux disk
cache inconsistency problem here grub translates the address again into the
address offset from partition that have enclosed it and then use that partition
device instead of disk device. 

> 
> > of which the address offset is calculated to be within it's range, to avoid 
> > the
> > cache problem of the whole disk device.
> 
> This sentence is convoluted. Please fix this.



> 
> > This patch fixed the linux disk cache workaround not being effective for
> 
> s/fixed/fixes/

OK.

> 
> > multipath/dm device because its partition device cannot be correctly 
> > determined
> > by grub_hostdisk_linux_find_partition function.

The grub_hostdisk_linux_find_partition() does the trick for finding the
partition device for a given partition start address and will be used in place
of whole disk device.

> 
> In general I am not happy with the commit message. It is difficult to
> understand where the problem is and why and how it is fixed.

The problem we encountered was that installing grub into multipath disk
partition didn't work reliably. And after debugging it boiled down to the disk
cache problem described above as strace result shown it was using whole disk
device. We then took another step forward in finding out the cause was missing
"/dev/dm-" name scheme handling in grub_hostdisk_linux_find_partition(). After
applying the fix the problem got fixed and we would like to have this fixing
patch upstreamed as it looks good material to be.

> 
> And lack of SOB...

Sorry. I will add SOB in later version.

Thanks,
Michael

> 
> Daniel
> 
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/grub-devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]