summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* tests: fix environmental dependency in m_rootdir_aclTheodore Ts'o2021-02-101-1/+1
| | | | | | | | The test script had a dependency on the group id for the "adm" group being 4. Fixed by hard-coding the group id for the default acl for the acl_dir directory. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* mke2fs: fix a importing a directory with an ACL and inline dataTheodore Ts'o2021-02-093-0/+222
| | | | | | | | | If an inode which is copied into a file system using "mke2fs -d" has an ACL (or extended attributes) and it is also using inline data, when the extended attribute(s) are copied in, the inline data gets dropped due to a missing call to ext2fs_xattrs_read(). Addresses-Debian-Bug: #971014 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* e2fsck: fix check of directories over 4GBAndreas Dilger2021-02-081-3/+2
| | | | | | | | | | | | | | | | | | | | | | | If directories grow larger than 4GB in size with the large_dir feature, e2fsck will consider them to be corrupted and clear the high bits of the size. Since it isn't very common to have directories this large, and unlike sparse files that don't have ill effects if the size is too large, an too-large directory will have all of the sparse blocks filled in by e2fsck, so huge directories should still be viewed with suspicion. Check for consistency between two of the three among block count, inode size, and superblock large_dir flag before deciding whether the directory inode should be fixed or cleared, or if large_dir should be set in the superblock. Update the f_recnect_bad test case to match new output. Fixes: 49f28a06b738 ("e2fsck: allow to check >2GB sized directory") Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Lustre-bug-id: https://jira.whamcloud.com/browse/LU-14345 Change-Id: I1b898cdab95d239ba1a7b37eb96255acadce7057 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* Merge branch 'maint' into nextTheodore Ts'o2021-01-284-0/+26
|\
| * AOSP: ANDROID: e2fsck: Do not mutate encrypted namesDaniel Rosenberg2021-01-274-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't mutate a name without the key, as this will at best cause the name to become gibberish, and at worst may introduce invalid characters or even fail to be unique after decoding, so drop duplicates instead. Files lost in this way will be reconnected to lost+found Fixes: dbff534ec685 ("e2fsck: suppress bad name checks for encrypted directories") Signed-off-by: Daniel Rosenberg <drosen@google.com> Google-Bug-Id: 138322712 Test: f_dup_de_crypt Change-Id: I8d6cc3984872868a845fafabc554abdd86351fcc From AOSP commit: 80b85f8a0b2ba7090a927f692ff9d2097ffd8d1f
* | tests: test case-folding checks in e2fsckGabriel Krisman Bertazi2021-01-274-0/+30
| | | | | | | | | | | | | | | | | | Add the test f_bad_fname which test fixes of invalid filenames and duplicates. Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com> Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | tests: add fast commit recovery testsHarshad Shirwadkar2021-01-274-0/+52
| | | | | | | | | | | | | | | | Add j_recover_fast_commit test that ensure that e2fsck is able to recover a disk from fast commit log. Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | ext4: fix tests to account for new dumpe2fs outputHarshad Shirwadkar2021-01-2122-54/+74
| | | | | | | | | | | | | | | | | | | | dumpe2fs tool now is capable of reporting number of fast commit blocks. There were slight changes in the output of dumpe2fs outside of fast commits. This patch fixes the regression tests to expect the new output. Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | Merge branch 'maint' into nextTheodore Ts'o2021-01-192-0/+2
|\ \ | |/
| * Define MKDIR_P in the Makefile.in files instead in MCONFIG.inTheodore Ts'o2020-10-042-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case where mkdir -p is not thread-safe (for example, if the build environment is using busybox's mkdir) the configure script will fall back to the slow (but safe) install-sh script. In that case MKDIR_P will be using a relative pathname; so we can't use speed optimization of defining configure substitutions in MCONFIG.in, since the substitution will be different depending on depth of the subdirectory in the Makefile.in file. https://github.com/tytso/e2fsprogs/issues/51 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | Merge branch 'maint' into nextTheodore Ts'o2020-10-017-8/+53
|\ \ | |/
| * tune2fs: reset MMP state on error exitAndreas Dilger2020-10-014-2/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If tune2fs cannot perform the requested change, ensure that the MMP block is reset to the unused state before exiting. Otherwise, the filesystem will be left with mmp_seq = EXT4_MMP_SEQ_FSCK set, which prevents it from being mounted afterward: EXT4-fs warning (device dm-9): ext4_multi_mount_protect:311: fsck is running on the filesystem Add a test to try some failed tune2fs operations and verify that the MMP block is left in a clean state afterward. Lustre-bug-id: https://jira.whamcloud.com/browse/LU-13672 Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
| * tests: remove unnecessary uncompressed image fileTheodore Ts'o2020-09-301-0/+0
| | | | | | | | Signed-off-by: Theodore Ts'o <tytso@mit.edu>
| * tests: use grep -E for better portability in r_inline_xattrTheodore Ts'o2020-03-232-6/+6
| | | | | | | | | | | | | | Since r_inline_xattr is using an extended regexp, we need grep -E on some implementations of grep. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | Merge branch 'maint' into nextTheodore Ts'o2020-03-163-13/+7
|\ \ | |/
| * libext2fs: make ext2fs_dirent_has_tail() more strictTheodore Ts'o2020-03-143-13/+7
| | | | | | | | | | | | | | | | | | | | Previously ext2fs_dirent_has_tail() would return true if the directory was corrupted. If the directory is corrupted, then by definition it doesn't have a valid checksum tail. (This fixes a big-endian failure on the master branch.) Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | tests: add test to excercise indexed directories with metadata_csumJan Kara2020-03-154-0/+117
| | | | | | | | | | | | | | | | | | | | Indexed directories have somewhat different format when metadata_csum is enabled. Add test to excercise linking in indexed directories and e2fsck rehash code in this case. Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | tests: modify f_large_dir test to excercise indexed dir handlingJan Kara2020-03-152-5/+32
| | | | | | | | | | | | | | | | | | | | | | Modify f_large_dir test to create indexed directory and create entries in it. That way the new code in ext2fs_link() for addition of entries into indexed directories gets executed including various special cases when growing htree. Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | e2fsck: clarify overflow link count error messageJan Kara2020-03-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When directory link count is set to overflow value (1) but during pass 4 we find out the exact link count would fit, we either silently fix this (which is not great because e2fsck then reports the fs was modified but output doesn't indicate why in any way), or we report that link count is wrong and ask whether we should fix it (in case -n option was specified). The second case is even more misleading because it suggests non-trivial fs corruption which then gets silently fixed on the next run. Similarly to how we fix up other non-problems, just create a new error message for the case directory link count is not overflown anymore and always report it to clarify what is going on. Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | Merge branch 'maint' into nextTheodore Ts'o2020-03-078-85/+0
|\ \ | |/
| * libext2fs: don't use O_DIRECT for files on tmpfsAndreas Dilger2020-03-078-85/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | If a filesystem image is on tmpfs, opening it with O_DIRECT for reading the MMP will fail. This is unnecessary, since the image file can't really be open on another node at this point. If the open with O_DIRECT fails, retry without it when plausible. Remove the special-casing of tmpfs from the mmp test cases. Change-Id: I41f4b31657b06f62f10be8d6e524d303dd36a321 Signed-off-by: Andreas Dilger <adilger@whamcloud.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | mke2fs: set overhead in super blockLi Dongyang2020-01-2631-44/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If overhead is not recorded in the super block, it is calculated during mount in kernel, for bigalloc file systems it takes O(groups**2) in time. For a 1PB device with 32K cluster size it takes ~12 mins to mount, with most of the time spent on figuring out overhead. While we can not improve the overhead algorithm in kernel due to the nature of bigalloc, we can work out the overhead during mke2fs and set it in the super block, avoiding calculating it every time when it mounts. Overhead is s_first_data_block plus internal journal blocks plus the block and inode bitmaps, inode table, super block backups and group descriptor blocks for every group. This patch introduces ext2fs_count_used_clusters(), which calculates the clusters used in the block bitmap for the given range. When bad blocks are involved, it gets tricky because the blocks counted as overhead and the bad blocks can end up in the same allocation cluster. In this case we will unmark the bad blocks from the block bitmap, convert to cluster bitmap and get the overhead, then mark the bad blocks back in the cluster bitmap. Reset the overhead to zero when resizing, we can not simply count the used blocks as overhead like we do when mke2fs. The overhead can be calculated by kernel side during mount. Signed-off-by: Li Dongyang <dongyangli@ddn.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | Merge branch 'maint' into nextTheodore Ts'o2020-01-251-0/+1
|\ \ | |/
| * mmp: don't assume NUL termination for MMP stringsAndreas Dilger2020-01-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Don't assume that mmp_nodename and mmp_bdevname are NUL terminated, since very long node/device names may completely fill the buffers. Limit string printing to the maximum buffer size for safety, and change the field definitions to __u8 to make it more clear that they are not NUL-terminated strings, as is done with other strings in the superblock that do not have NUL termination. Signed-off-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | e2fsck: restart the full e2fsck run if the bad block inode is invalidateTheodore Ts'o2020-01-171-0/+2
| | | | | | | | | | | | | | | | | | | | Previously, we just cleared the bad block list and restarted the inode scan, but we didn't do a full reset of all of e2fsck's state. When code handling this case; we didn't have the framework to do a restarted run. Now that we do, we can simply the code and make it more correct. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | Rename functions, types, constants to reflect jbd2 usageTheodore Ts'o2019-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had previously stuck to using the names from ext3/jbd kernel files, and used a script in contrib/jbd2-resync.sh to convert the kernel files to use the ext3/jbd conventions so we could keep the files e2fsck/recovery.c and e2fsck/revoke.c in sync with jbd2/recovery.c and jbd2/revoke.c, respectively. This has been getting harder and harder, so let's make a global sweep through e2fsprogs to use the jbd2 names. Fortunately none of the ext3/jbd names had leaked out into publically exported header files, so this is only an internal change. Which looks scary, but it's basically a search and replace, so if it compiles it's going to be correct. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | e2fsck: check for consistent encryption policiesEric Biggers2019-10-098-2/+304
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By design, the kernel enforces that all files in an encrypted directory use the same encryption policy as the directory. It's not possible to violate this constraint using syscalls. Lookups of files that violate this constraint also fail, in case the disk was manipulated. But this constraint can also be violated by accidental filesystem corruption. E.g., a power cut when using ext4 without a journal might leave new files without the encryption bit and/or xattr. Thus, it's important that e2fsck correct this condition. Therefore, this patch makes the following changes to e2fsck: - During pass 1 (inode table scan), create a map from inode number to encryption policy for all encrypted inodes. But it's optimized so that the full xattrs aren't saved but rather only 32-bit "policy IDs", since usually many inodes share the same encryption policy. Also, if an encryption xattr is missing, offer to clear the encrypt flag. If an encryption xattr is clearly corrupt, offer to clear the inode. - During pass 2 (directory structure check), use the map to verify that all regular files, directories, and symlinks in encrypted directories use the directory's encryption policy. Offer to clear any directory entries for which this isn't the case. Add a new test "f_bad_encryption" to test the new behavior. Due to the new checks, it was also necessary to update the existing test "f_short_encrypted_dirent" to add an encryption xattr to the test file, since it was missing one before, which is now considered invalid. Google-Bug-Id: 135138675 Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Andreas Dilger <adilger@dilger.ca>
* | Merge branch 'maint' into nextTheodore Ts'o2019-09-036-4/+16
|\ \ | |/
| * e2fsck: check the validity of the casefold flagTheodore Ts'o2019-09-031-0/+6
| | | | | | | | | | | | | | The casefold flag is only allowed on directories and when the casefold feature is enabled. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
| * e2fsck: make the low dtime check consistent when using the backup superblockTheodore Ts'o2019-09-025-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The backup superblock may have a last mounted time of zero, if it has never been updated since the file system was created. In that case, the low dtime check may get disabled when using the backup superblock, even though subsequent e2fsck runs will end up using the low dtime check. This can cause a failure of ext4/007, since since when e2fsck is run a second time after the file system is mounted, the low dtime check will trigger the e2fsck complaint: Inode NNNN was part of the orphaned inode list. IGNORED. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | tests: add tests for uninitialized bitmapsAndreas Dilger2019-08-1832-0/+260
| | | | | | | | | | | | | | | | Various tests for handing uninitialized block and inode bitmaps, and inodes beyond the in-use high watermark. Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | tests: verify > 65000 subdirectoriesAndreas Dilger2019-08-184-0/+53
|/ | | | | | | Add test case to verify nlink handling of large directories. Signed-off-by: Andreas Dilger <andreas.dilger@intel.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* tests: suppress e2image version number from being printedTheodore Ts'o2019-07-142-2/+2
| | | | Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* tests: fix test_script so that it will run all tests if w/o argumentsTheodore Ts'o2019-07-131-1/+1
| | | | Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* tests: add test for e2fsck of verity fileEric Biggers2019-05-305-0/+38
| | | | | | | | | | | | Test that e2fsck doesn't report errors when an inode with the 'verity' flag has blocks past i_size. This is a regression test for commits 3baafde6a8ae ("e2fsck: allow verity files to have initialized blocks past i_size") and 43466d039689 ("e2fsck: handle verity files in scan_extent_node()"). Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* e2fsck: check and fix tails of all bitmap blocksTheodore Ts'o2019-05-0626-2/+52
| | | | | | | | | | | | | | | | | | Currently, e2fsck effectively checks only tail of the last inode and block bitmap in the filesystem. Thus if some previous bitmap has unset bits it goes unnoticed. Mostly these tail bits in the bitmap are ignored; however, if blocks_per_group are smaller than 8*blocksize, the multi-block allocator in the kernel can get confused when the tail bits are unset and return bogus free extent. Add support to libext2fs to check these bitmap tails when loading bitmaps (as that's about the only place which has access to the bitmap tail bits) and make e2fsck use this functionality to detect buggy bitmap tails and fix them (by rewriting the bitmaps). Reported-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz>
* tests: fix f_valid_ea_in_inode to use the ea_featureTheodore Ts'o2019-03-242-1/+1
| | | | | | | | | This time for real! The test-ea file has three very long xattrs, description and description2 which are identical and share an inode to store their value, and description3, which has a different value, and thus uses another inode for storing its value. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* tests: add test for e2image -b optionArtem Blagodarenko2019-03-063-0/+33
| | | | | | | | The test makes raw image from partition with broken super block and executes e2fsck. Signed-off-by: Artem Blagodarenko <c17828@cray.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* Merge branch 'maint' into nextTheodore Ts'o2019-01-293-9/+28
|\
| * tests: generate test_data.tmp file from a scriptTheodore Ts'o2019-01-033-9/+28
| | | | | | | | | | | | | | | | | | | | Even if the debugfs executable is not sparse, it might contain a 1k aligned block which is all zeros, which when written into a 1k block file system by a test like d_loaddump will result in a sparse file and causing one or more test failures. Google-Bug-Id: 122085761 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | Merge branch 'maint' into nextTheodore Ts'o2018-12-169-39/+39
|\ \ | |/
| * e2fsck: use "Optimize?" prompt for PR_1E_CAN_{COLLAPSE,NARROW}_EXTENT_TREETheodore Ts'o2018-12-159-39/+39
| | | | | | | | | | | | | | | | | | If e2fsck can optimize an inode's extent tree, it should ask for permission to optimize it, not to "fix" it. This was causing some confusion, since some users interpreted this prompt as an indication that the file system was inconsistent. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | Merge branch 'maint' into nextTheodore Ts'o2018-11-266-11/+85
|\ \ | |/
| * tune2fs: fix false warning that a UUID change will take a long timeTheodore Ts'o2018-11-232-11/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the file system only has the flex_bg feature enabled (with out the metadata_csum feature enabled), it won't take a long time time fix up the checksums after changing the UUID. While it does need to recalculate all of the checksums in the block group descriptors, that doesn't take a long time. Also, if the ea_data feature is enabled, changing the UUID will also take a long time, and we weren't warning the user about that case. Fix up the warning message so it doesn't mislead people, and is more accurate. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
| * e2fsck: check xattr 'system.data' before setting inline_data featureLi Dongyang2018-11-154-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | ext2fs_inline_data_size will happy return 0 and set size to EXT4_MIN_INLINE_DATA_SIZE even when inode doesn't have xattr 'system.data', a corrupted i_flags could make e2fsck enable the inline_data on the superblock. We should only offer to enable inline_data when i_flags is set and xattr 'system.data' can be found. Also use correct prompt for PR_1_INLINE_DATA_FEATURE. Signed-off-by: Li Dongyang <dongyangli@ddn.com>
* | Merge branch 'maint' into nextTheodore Ts'o2018-10-214-0/+58
|\ \ | |/
| * tests: move inode and its interior extent tree blockTheodore Ts'o2018-10-204-0/+58
| | | | | | | | | | | | | | Add a test case for the bug fixed in 4b3038134baf: "resize2fs: update checksums in the extent tree's relocated block" Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | Merge branch 'maint' into nextTheodore Ts'o2018-10-111-1/+1
|\ \ | |/
| * test_one: make sure the tmpfile is cleaned up if the test script exitsTheodore Ts'o2018-10-101-1/+1
| | | | | | | | | | | | | | f_detect_junk will skip the test by exiting; and in that case we need to make sure the test's tmpfile gets cleaned up. Signed-off-by: Theodore Ts'o <tytso@mit.edu>
* | Merge branch 'maint' into nextTheodore Ts'o2018-10-045-0/+125
|\ \ | |/