Patchwork SILO fails to read silo.conf from EXT4 FS

login
register
mail settings
Submitter David Miller
Date Aug. 16, 2012, 3:17 a.m.
Message ID <20120815.201738.1239404312150755618.davem@davemloft.net>
Download mbox | patch
Permalink /patch/177890/
State RFC
Delegated to: David Miller
Headers show

Comments

David Miller - Aug. 16, 2012, 3:17 a.m.
From: Raúl Porcel <armin76@gentoo.org>
Date: Sun, 29 Jul 2012 13:35:54 +0200

> With the rewrite of the e2fs part of SILO, its unable to read
> /etc/silo.conf from an EXT4 FS. It can read from EXT2 and EXT3,
> though.

There are some minor errors in the extent leaf traversal, can you try
this patch below?

If this fails I'll give you a patch which adds some tracing so we can
diagnose this further.

Thanks!

--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Raúl Porcel - Aug. 18, 2012, 4:02 p.m.
On 08/16/12 05:17, David Miller wrote:
> From: Raúl Porcel<armin76@gentoo.org>
> Date: Sun, 29 Jul 2012 13:35:54 +0200
>
>> With the rewrite of the e2fs part of SILO, its unable to read
>> /etc/silo.conf from an EXT4 FS. It can read from EXT2 and EXT3,
>> though.
>
> There are some minor errors in the extent leaf traversal, can you try
> this patch below?
>
> If this fails I'll give you a patch which adds some tracing so we can
> diagnose this further.
>
> Thanks!
>
>[snip]

That fixed it.

Thanks!


--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Aug. 19, 2012, 4:51 a.m.
From: Raúl Porcel <armin76@gentoo.org>
Date: Sat, 18 Aug 2012 18:02:40 +0200

> On 08/16/12 05:17, David Miller wrote:
>> From: Raúl Porcel<armin76@gentoo.org>
>> Date: Sun, 29 Jul 2012 13:35:54 +0200
>>
>>> With the rewrite of the e2fs part of SILO, its unable to read
>>> /etc/silo.conf from an EXT4 FS. It can read from EXT2 and EXT3,
>>> though.
>>
>> There are some minor errors in the extent leaf traversal, can you try
>> this patch below?
>>
>> If this fails I'll give you a patch which adds some tracing so we can
>> diagnose this further.
>>
>> Thanks!
>>
>>[snip]
> 
> That fixed it.

And now committed to git, thanks a lot for testing.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/second/fs/ext2.c b/second/fs/ext2.c
index 7eb665f..018aced 100644
--- a/second/fs/ext2.c
+++ b/second/fs/ext2.c
@@ -147,7 +147,7 @@  static struct ext4_extent_header *search_leaf(struct silo_ext2_state *s,
 			return ehp;
 
 		for (i = 0; i < ext2_to_cpu_16(ehp->eh_entries); i++, idxp++)
-			if (ext2_to_cpu_32(idxp->ei_block) > file_block)
+			if (file_block < ext2_to_cpu_32(idxp->ei_block))
 				break;
 
 		if (i == 0)
@@ -226,14 +226,15 @@  static unsigned long long resolve_extent(struct silo_ext2_state *s,
 	ep = (struct ext4_extent *) (ehp + 1);
 
 	for (i = 0; i < ext2_to_cpu_16(ehp->eh_entries); i++, ep++)
-		if (ext2_to_cpu_32(ep->ee_block) > file_block)
+		if (file_block < ext2_to_cpu_32(ep->ee_block))
 			break;
 
 	if (i == 0)
 		return BLOCK_MAP_ERROR;
 
+	ep -= 1;
 	file_block -= ext2_to_cpu_32(ep->ee_block);
-	if (ext2_to_cpu_16(ep->ee_len) < file_block)
+	if (file_block >= ext2_to_cpu_16(ep->ee_len))
 		return BLOCK_MAP_ERROR;
 
 	hi = ((unsigned long long)ext2_to_cpu_16(ep->ee_start_hi)) << 32;