Magellan Linux

Contents of /trunk/busybox/patches/busybox-1.20.2-fix-the-wrongly-stored-fs-creation-time.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1856 - (show annotations) (download)
Thu Jul 26 09:16:24 2012 UTC (11 years, 9 months ago) by niro
File size: 5656 byte(s)
-more upstream patches
1 From c9a13116a4497f4597ad5db6eb3cac9680fd6fc4 Mon Sep 17 00:00:00 2001
2 From: Denys Vlasenko <vda.linux@googlemail.com>
3 Date: Thu, 21 Jun 2012 14:50:46 +0000
4 Subject: mount: fix the wrongly stored fs creation time
5
6 This bug made our ext2 images non-mountable by ext4 driver.
7
8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
9 ---
10 diff --git a/include/bb_e2fs_defs.h b/include/bb_e2fs_defs.h
11 index 071c660..b400f8c 100644
12 --- a/include/bb_e2fs_defs.h
13 +++ b/include/bb_e2fs_defs.h
14 @@ -406,25 +406,43 @@ struct ext2_super_block {
15 * Performance hints. Directory preallocation should only
16 * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
17 */
18 - uint8_t s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
19 - uint8_t s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
20 + uint8_t s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
21 + uint8_t s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
22 uint16_t s_reserved_gdt_blocks; /* Per group table for online growth */
23 /*
24 * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
25 */
26 - uint8_t s_journal_uuid[16]; /* uuid of journal superblock */
27 - uint32_t s_journal_inum; /* inode number of journal file */
28 +/*D0*/ uint8_t s_journal_uuid[16]; /* uuid of journal superblock */
29 +/*E0*/ uint32_t s_journal_inum; /* inode number of journal file */
30 uint32_t s_journal_dev; /* device number of journal file */
31 uint32_t s_last_orphan; /* start of list of inodes to delete */
32 uint32_t s_hash_seed[4]; /* HTREE hash seed */
33 uint8_t s_def_hash_version; /* Default hash version to use */
34 uint8_t s_jnl_backup_type; /* Default type of journal backup */
35 uint16_t s_reserved_word_pad;
36 - uint32_t s_default_mount_opts;
37 +/*100*/ uint32_t s_default_mount_opts;
38 uint32_t s_first_meta_bg; /* First metablock group */
39 + /* ext3 additions */
40 uint32_t s_mkfs_time; /* When the filesystem was created */
41 uint32_t s_jnl_blocks[17]; /* Backup of the journal inode */
42 - uint32_t s_reserved[172]; /* Padding to the end of the block */
43 + /* 64bit support valid if EXT4_FEATURE_COMPAT_64BIT */
44 +/*150*/ uint32_t s_blocks_count_hi; /* Blocks count */
45 + uint32_t s_r_blocks_count_hi; /* Reserved blocks count */
46 + uint32_t s_free_blocks_count_hi; /* Free blocks count */
47 + uint16_t s_min_extra_isize; /* All inodes have at least # bytes */
48 + uint16_t s_want_extra_isize; /* New inodes should reserve # bytes */
49 + uint32_t s_flags; /* Miscellaneous flags */
50 + uint16_t s_raid_stride; /* RAID stride */
51 + uint16_t s_mmp_interval; /* # seconds to wait in MMP checking */
52 + uint64_t s_mmp_block; /* Block for multi-mount protection */
53 + uint32_t s_raid_stripe_width; /* blocks on all data disks (N*stride)*/
54 + uint8_t s_log_groups_per_flex; /* FLEX_BG group size */
55 + uint8_t s_reserved_char_pad2;
56 + uint16_t s_reserved_pad;
57 + uint32_t s_reserved[162]; /* Padding to the end of the block */
58 +};
59 +struct BUG_ext2_super_block {
60 + char bug[sizeof(struct ext2_super_block) == 1024 ? 1 : -1];
61 };
62
63 /*
64 diff --git a/testsuite/mount.tests b/testsuite/mount.tests
65 index c5891be..a0bc508 100755
66 --- a/testsuite/mount.tests
67 +++ b/testsuite/mount.tests
68 @@ -36,7 +36,8 @@ testing "mount -o remount,mand" \
69 "mount -o loop mount.image1m $testdir "\
70 "&& grep -Fc $testdir </proc/mounts "\
71 "&& mount -o remount,mand $testdir "\
72 -"&& grep -F $testdir </proc/mounts | grep -c '[, ]mand[, ]'" \
73 +"&& grep -F $testdir </proc/mounts | grep -c '[, ]mand[, ]'"\
74 +"|| grep -F $testdir </proc/mounts" \
75 "1\n""1\n" \
76 "" ""
77
78 @@ -83,4 +84,28 @@ b
79 "" ""
80 SKIP=
81
82 +
83 +testing "mount RO loop" "\
84 +exec 2>&1
85 +umount -d mount.dir 2>/dev/null
86 +rmdir mount.dir 2>/dev/null
87 +mkdir -p mount.dir
88 +(
89 +cd mount.dir || { echo 'cd error'; exit 1; }
90 +mkdir z1 z2 || { echo 'mkdir error'; exit 1; }
91 +mount -t tmpfs tmpfs z1 || { echo 'mount tmpfs error'; exit 1; }
92 +dd if=/dev/zero of=z1/e2img count=10 bs=1M 2>/dev/null || { echo 'dd error'; exit 1; }
93 +mke2fs -F z1/e2img 2>/dev/null >&2 || { echo 'mke2fs error'; exit 1; }
94 +mount -r -o loop -t ext2 z1/e2img z2 || { echo 'mount -r -o loop error'; exit 1; }
95 +mount -o remount,ro z1 || { echo 'mount -o remount,ro error'; exit 1; }
96 +)
97 +umount -d mount.dir/z2
98 +##losetup -d /dev/loop*
99 +umount -d mount.dir/z1
100 +rm -rf mount.dir
101 +echo DONE
102 +" \
103 +"DONE\n" "" ""
104 +
105 +
106 exit $FAILCOUNT
107 diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c
108 index 69b25c9..3258d7e 100644
109 --- a/util-linux/mkfs_ext2.c
110 +++ b/util-linux/mkfs_ext2.c
111 @@ -53,11 +53,6 @@
112 #define ENABLE_FEATURE_MKFS_EXT2_RESERVED_GDT 0
113 #define ENABLE_FEATURE_MKFS_EXT2_DIR_INDEX 1
114
115 -// from e2fsprogs
116 -#define s_reserved_gdt_blocks s_padding1
117 -#define s_mkfs_time s_reserved[0]
118 -#define s_flags s_reserved[22]
119 -
120 #define EXT2_HASH_HALF_MD4 1
121 #define EXT2_FLAGS_SIGNED_HASH 0x0001
122 #define EXT2_FLAGS_UNSIGNED_HASH 0x0002
123 @@ -482,8 +477,10 @@ int mkfs_ext2_main(int argc UNUSED_PARAM, char **argv)
124 STORE_LE(sb->s_magic, EXT2_SUPER_MAGIC);
125 STORE_LE(sb->s_inode_size, inodesize);
126 // set "Required extra isize" and "Desired extra isize" fields to 28
127 - if (inodesize != sizeof(*inode))
128 - STORE_LE(sb->s_reserved[21], 0x001C001C);
129 + if (inodesize != sizeof(*inode)) {
130 + STORE_LE(sb->s_min_extra_isize, 0x001c);
131 + STORE_LE(sb->s_want_extra_isize, 0x001c);
132 + }
133 STORE_LE(sb->s_first_ino, EXT2_GOOD_OLD_FIRST_INO);
134 STORE_LE(sb->s_log_block_size, blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE);
135 STORE_LE(sb->s_log_frag_size, blocksize_log2 - EXT2_MIN_BLOCK_LOG_SIZE);
136 --
137 cgit v0.9.0.1-2-gef13