diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2015-10-23 04:22:04 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-10-27 07:24:28 +0000 |
commit | c1d5e897909bc659eee6151d097781dd3c7931c7 (patch) | |
tree | 9a95595546805bee8287297179b879f0ec973a4e /meta/recipes-devtools | |
parent | 426a9b78d0018a739ec06c5dddcd0f8b6c4194cf (diff) | |
download | poky-c1d5e897909bc659eee6151d097781dd3c7931c7.tar.gz |
e2fsprogs: backport a patch to fix filetype for hardlink
Backport a patch to fix hardlinks filetype:
IMAGE_INSTALL_append = " e2fsprogs"
$ ./tmp/sysroots/x86_64-linux/sbin/fsck.ext4 tmp/deploy/images/qemux86/core-image-minimal-qemux86.ext4 -f
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Setting filetype for entry 'fsck.ext2' in /sbin (80) to 1.
Setting filetype for entry 'mkfs.ext4' in /sbin (80) to 1.
Setting filetype for entry 'fsck.ext4' in /sbin (80) to 1.
Setting filetype for entry 'mkfs.ext4dev' in /sbin (80) to 1.
Setting filetype for entry 'fsck.ext3' in /sbin (80) to 1.
Setting filetype for entry 'mkfs.ext2' in /sbin (80) to 1.
Setting filetype for entry 'mkfs.ext3' in /sbin (80) to 1.
Setting filetype for entry 'e2fsck' in /sbin (80) to 1.
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
test.img: ***** FILE SYSTEM WAS MODIFIED *****
test.img: 799/65536 files (0.1% non-contiguous), 14652/262144 blocks
Now when run it again, we may get:
[snip]
Pass 3A: Optimizing directories
[snip]
test.img: ***** FILE SYSTEM WAS MODIFIED *****
test.img: 799/65536 files (0.1% non-contiguous), 14652/262144 blocks
This is fine since it is optimizing, from "man e2fsck":
e2fsck may sometimes optimize a few directories --- for example, if
directory indexing is enabled and a directory is not indexed and would
benefit from being indexed, or if the index structures are corrupted
and need to be rebuilt.
[YOCTO #8544]
(From OE-Core rev: 02ad8e3c32656a74fa82284105706ae67e5108f3)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs/copy-in-create-hardlinks-with-the-correct-directory-.patch | 81 | ||||
-rw-r--r-- | meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb | 1 |
2 files changed, 82 insertions, 0 deletions
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs/copy-in-create-hardlinks-with-the-correct-directory-.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs/copy-in-create-hardlinks-with-the-correct-directory-.patch new file mode 100644 index 0000000000..f549693570 --- /dev/null +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs/copy-in-create-hardlinks-with-the-correct-directory-.patch | |||
@@ -0,0 +1,81 @@ | |||
1 | From 2dcf8e92bc39e05b3c799f53fe911c024aee4375 Mon Sep 17 00:00:00 2001 | ||
2 | From: Robert Yang <liezhi.yang@windriver.com> | ||
3 | Date: Fri, 23 Oct 2015 03:21:05 -0700 | ||
4 | Subject: [PATCH] copy-in: create hardlinks with the correct directory | ||
5 | filetype | ||
6 | |||
7 | When we're creating hard links via ext2fs_link, the (misnamed?) flags | ||
8 | argument specifies the filetype for the directory entry. This is | ||
9 | *derived* from i_mode, so provide a translator. Otherwise, fsck will | ||
10 | complain about unset file types. | ||
11 | |||
12 | Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> | ||
13 | Signed-off-by: Theodore Ts'o <tytso@mit.edu> | ||
14 | |||
15 | Upstream-Status: Backport | ||
16 | |||
17 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
18 | --- | ||
19 | misc/create_inode.c | 33 +++++++++++++++++++++++++++++++-- | ||
20 | 1 file changed, 31 insertions(+), 2 deletions(-) | ||
21 | |||
22 | diff --git a/misc/create_inode.c b/misc/create_inode.c | ||
23 | index fcec5aa..b8565da 100644 | ||
24 | --- a/misc/create_inode.c | ||
25 | +++ b/misc/create_inode.c | ||
26 | @@ -22,6 +22,33 @@ | ||
27 | /* For saving the hard links */ | ||
28 | int hdlink_cnt = HDLINK_CNT; | ||
29 | |||
30 | +static int ext2_file_type(unsigned int mode) | ||
31 | +{ | ||
32 | + if (LINUX_S_ISREG(mode)) | ||
33 | + return EXT2_FT_REG_FILE; | ||
34 | + | ||
35 | + if (LINUX_S_ISDIR(mode)) | ||
36 | + return EXT2_FT_DIR; | ||
37 | + | ||
38 | + if (LINUX_S_ISCHR(mode)) | ||
39 | + return EXT2_FT_CHRDEV; | ||
40 | + | ||
41 | + if (LINUX_S_ISBLK(mode)) | ||
42 | + return EXT2_FT_BLKDEV; | ||
43 | + | ||
44 | + if (LINUX_S_ISLNK(mode)) | ||
45 | + return EXT2_FT_SYMLINK; | ||
46 | + | ||
47 | + if (LINUX_S_ISFIFO(mode)) | ||
48 | + return EXT2_FT_FIFO; | ||
49 | + | ||
50 | + if (LINUX_S_ISSOCK(mode)) | ||
51 | + return EXT2_FT_SOCK; | ||
52 | + | ||
53 | + return 0; | ||
54 | +} | ||
55 | + | ||
56 | + | ||
57 | /* Link an inode number to a directory */ | ||
58 | static errcode_t add_link(ext2_ino_t parent_ino, ext2_ino_t ino, const char *name) | ||
59 | { | ||
60 | @@ -34,14 +61,16 @@ static errcode_t add_link(ext2_ino_t parent_ino, ext2_ino_t ino, const char *nam | ||
61 | return retval; | ||
62 | } | ||
63 | |||
64 | - retval = ext2fs_link(current_fs, parent_ino, name, ino, inode.i_flags); | ||
65 | + retval = ext2fs_link(current_fs, parent_ino, name, ino, | ||
66 | + ext2_file_type(inode.i_mode)); | ||
67 | if (retval == EXT2_ET_DIR_NO_SPACE) { | ||
68 | retval = ext2fs_expand_dir(current_fs, parent_ino); | ||
69 | if (retval) { | ||
70 | com_err(__func__, retval, "while expanding directory"); | ||
71 | return retval; | ||
72 | } | ||
73 | - retval = ext2fs_link(current_fs, parent_ino, name, ino, inode.i_flags); | ||
74 | + retval = ext2fs_link(current_fs, parent_ino, name, ino, | ||
75 | + ext2_file_type(inode.i_mode)); | ||
76 | } | ||
77 | if (retval) { | ||
78 | com_err(__func__, retval, "while linking %s", name); | ||
79 | -- | ||
80 | 1.7.9.5 | ||
81 | |||
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb index 97e29c8916..ce7d2e8628 100644 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.9.bb | |||
@@ -23,6 +23,7 @@ SRC_URI += "file://acinclude.m4 \ | |||
23 | file://cache_inode.patch \ | 23 | file://cache_inode.patch \ |
24 | file://CVE-2015-0247.patch \ | 24 | file://CVE-2015-0247.patch \ |
25 | file://0001-libext2fs-fix-potential-buffer-overflow-in-closefs.patch \ | 25 | file://0001-libext2fs-fix-potential-buffer-overflow-in-closefs.patch \ |
26 | file://copy-in-create-hardlinks-with-the-correct-directory-.patch \ | ||
26 | " | 27 | " |
27 | 28 | ||
28 | SRC_URI[md5sum] = "3f8e41e63b432ba114b33f58674563f7" | 29 | SRC_URI[md5sum] = "3f8e41e63b432ba114b33f58674563f7" |