]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/grub-2.02-xfs-accept-filesystem-with-sparse-inodes.patch
suricata: Fix amount of listened nfqueues
[ipfire-2.x.git] / src / patches / grub-2.02-xfs-accept-filesystem-with-sparse-inodes.patch
CommitLineData
848ac690
SS
1From cda0a857dd7a27cd5d621747464bfe71e8727fff Mon Sep 17 00:00:00 2001
2From: Daniel Kiper <daniel.kiper@oracle.com>
3Date: Tue, 29 May 2018 16:16:02 +0200
4Subject: xfs: Accept filesystem with sparse inodes
5
6The sparse inode metadata format became a mkfs.xfs default in
7xfsprogs-4.16.0, and such filesystems are now rejected by grub as
8containing an incompatible feature.
9
10In essence, this feature allows xfs to allocate inodes into fragmented
11freespace. (Without this feature, if xfs could not allocate contiguous
12space for 64 new inodes, inode creation would fail.)
13
14In practice, the disk format change is restricted to the inode btree,
15which as far as I can tell is not used by grub. If all you're doing
16today is parsing a directory, reading an inode number, and converting
17that inode number to a disk location, then ignoring this feature
18should be fine, so I've added it to XFS_SB_FEAT_INCOMPAT_SUPPORTED
19
20I did some brief testing of this patch by hacking up the regression
21tests to completely fragment freespace on the test xfs filesystem, and
22then write a large-ish number of inodes to consume any existing
23contiguous 64-inode chunk. This way any files the grub tests add and
24traverse would be in such a fragmented inode allocation. Tests passed,
25but I'm not sure how to cleanly integrate that into the test harness.
26
27Signed-off-by: Eric Sandeen <sandeen@redhat.com>
28Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
29Tested-by: Chris Murphy <lists@colorremedies.com>
30---
31 grub-core/fs/xfs.c | 11 ++++++++++-
32 1 file changed, 10 insertions(+), 1 deletion(-)
33
34diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
35index c6031bd..3b00c74 100644
36--- a/grub-core/fs/xfs.c
37+++ b/grub-core/fs/xfs.c
38@@ -79,9 +79,18 @@ GRUB_MOD_LICENSE ("GPLv3+");
39 #define XFS_SB_FEAT_INCOMPAT_SPINODES (1 << 1) /* sparse inode chunks */
40 #define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */
41
42-/* We do not currently verify metadata UUID so it is safe to read such filesystem */
43+/*
44+ * Directory entries with ftype are explicitly handled by GRUB code.
45+ *
46+ * We do not currently read the inode btrees, so it is safe to read filesystems
47+ * with the XFS_SB_FEAT_INCOMPAT_SPINODES feature.
48+ *
49+ * We do not currently verify metadata UUID, so it is safe to read filesystems
50+ * with the XFS_SB_FEAT_INCOMPAT_META_UUID feature.
51+ */
52 #define XFS_SB_FEAT_INCOMPAT_SUPPORTED \
53 (XFS_SB_FEAT_INCOMPAT_FTYPE | \
54+ XFS_SB_FEAT_INCOMPAT_SPINODES | \
55 XFS_SB_FEAT_INCOMPAT_META_UUID)
56
57 struct grub_xfs_sblock
58--
59cgit v1.0-41-gc330
60