grub-mkconfig does not fsync() or sync() - can result in boot failure

2018-04-24 Thread Chris Murphy
Hi, I've done a 'strace -ff -o stracegrub.out grub-mkconfig' and there is no fsync() or sync() at all, so this does not seem crash safe for either non-journaled or journaled file systems. The most typical result is the grub.cfg is stale, the grub.cfg.new is truncated. This isn't in a state a lot

Re: What is this grub_disk_read doing in the i386 linux loader?

2018-04-24 Thread Andrew Jeddeloh
Thanks for the reply. I'm not sure I follow. Looking over the 32 bit boot spec, it looks like the process is: 1) zero out linux_params - grub does this 2) copy the linux boot params (from 0x1f1) into linux params - grub does this by reading from 0x0 until the end of lh, then copying lh+0x1f1

[PATCH 7/7] Add raid6 recovery.

2018-04-24 Thread Goffredo Baroncelli
The code origins from "raid6_recovery.c". The code was changed because the original one assumed that both the disk address and size are multiple of GRUB_DISK_SECTOR_SIZE. This is not true for grub btrfs driver. The code was made more generalized using a function pointer for reading the data from

[PATCH 4/7] Avoiding scanning for an already not found device.

2018-04-24 Thread Goffredo Baroncelli
If a device is missing, create the entry in data->devices_attached[] array. This avoid un-necessary devices rescan. Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git

[PATCH 2/7] Add helper to check the btrfs header.

2018-04-24 Thread Goffredo Baroncelli
This helper was used in few places to help the debugging. As conservative approach, in case of error it is only logged. Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 22 +- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git

[PATCH 5/7] Refactor the code of read from disk

2018-04-24 Thread Goffredo Baroncelli
This is a preparatory patch, to help the adding of the raid5/6 recovery code Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 111 --- 1 file changed, 62 insertions(+), 49 deletions(-) diff --git a/grub-core/fs/btrfs.c

[PATCH 6/7] Add support for recovery for a raid5 btrfs profiles.

2018-04-24 Thread Goffredo Baroncelli
Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 206 +-- 1 file changed, 199 insertions(+), 7 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index 697322125..5c76a68f3 100644 ---

[PATCH 3/7] Move from the find_device the error logging logic to the callee.

2018-04-24 Thread Goffredo Baroncelli
Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index 01a1fc7a1..745bb854e 100644 --- a/grub-core/fs/btrfs.c +++ b/grub-core/fs/btrfs.c @@ -602,9

[PATCH V2] Add support for BTRFS raid5/6 to GRUB

2018-04-24 Thread Goffredo Baroncelli
Hi All, the aim of this patches set is to provide support for a BTRFS raid5/6 filesystem in GRUB. The first patch, implements the basic support for raid5/6. I.e this works when all the disks are present. The next 4 patches, are preparatory ones. The last two implements the support for

[PATCH 1/7] Add support for reading a filesystem with a raid5 or raid6 profile.

2018-04-24 Thread Goffredo Baroncelli
Signed-off-by: Goffredo Baroncelli --- grub-core/fs/btrfs.c | 32 1 file changed, 32 insertions(+) diff --git a/grub-core/fs/btrfs.c b/grub-core/fs/btrfs.c index be195448d..b0032ea46 100644 --- a/grub-core/fs/btrfs.c +++

Re: What is this grub_disk_read doing in the i386 linux loader?

2018-04-24 Thread Daniel Kiper
On Thu, Apr 19, 2018 at 03:22:55PM -0700, Andrew Jeddeloh wrote: > While solving a bug in the coreos fork of grub I came across this disk > read in the i386 linux loader [1]. It looks like its reading whatever > is after the boot param header in the kernel file (defined by the > linux x86 boot

Re: Multiboot ELF segment handling patch

2018-04-24 Thread Daniel Kiper
On Mon, Apr 23, 2018 at 08:26:34PM +0200, Alexander Boettcher wrote: > Hello, > > On 17.04.2018 21:40, Daniel Kiper wrote > >> The overriden memory may contain device memory (vga text mode e.g.), which > >> leads to strange boot behaviour. > > > > Have you been able to take a look at memory

Re: [PATCH v2] Makefile.am: Add `all_video` to `default_payload.elf`

2018-04-24 Thread Daniel Kiper
On Mon, Apr 23, 2018 at 09:45:02PM +0200, Paul Menzel wrote: > Dear GRUB folks, > > > Am Mittwoch, den 21.03.2018, 09:28 +0100 schrieb Paul Menzel: > > From a199bc1f64e33aa942b23fe6d16670cc6002bb6c Mon Sep 17 00:00:00 2001 > > From: Paul Menzel > > Date: Sun, 16

Re: [PATCH] pass kernel command line as verbatim

2018-04-24 Thread Daniel Kiper
On Wed, Apr 18, 2018 at 03:07:15PM +0800, Michael Chang wrote: > On Tue, Apr 17, 2018 at 06:37:06PM +0200, Daniel Kiper wrote: > > On Wed, Apr 11, 2018 at 05:17:03PM +0800, Michael Chang wrote: > > > And this bug report seems relevant .. > > > > > > https://savannah.gnu.org/bugs/?49937 > > > > > >

Re: [PATCH v2] bufio: round up block size to power of 2

2018-04-24 Thread Daniel Kiper
On Tue, Apr 24, 2018 at 02:13:04PM +0800, Michael Chang wrote: > Rounding up the bufio->block_size to meet power of 2 to facilitate next_buf > calcuation in grub_bufio_read. > > Signed-off-by: Michael Chang > > v2: Next time please put "---" before "v2:" just after SOB. This way

[PATCH v2] bufio: round up block size to power of 2

2018-04-24 Thread Michael Chang
Rounding up the bufio->block_size to meet power of 2 to facilitate next_buf calcuation in grub_bufio_read. Signed-off-by: Michael Chang v2: - Use a more terse approach to round up size suggested by Daniel - Added comment to explain why to have the size rounded ---

Re: [PATCH] bufio: round up block size to power of 2

2018-04-24 Thread Michael Chang
On Mon, Apr 23, 2018 at 03:57:22PM +0200, Daniel Kiper wrote: > On Fri, Apr 20, 2018 at 03:21:30PM +0800, Michael Chang wrote: > > Rounding up the bufio->block_size to meet power of 2 to facilitate next_buf > > calcuation in grub_bufio_read. > > > > Signed-off-by: Michael Chang >