mirror of https://github.com/vitalif/e2fsprogs
e2fsck: Fix duplicate directory entries for non-indexed directories
Duplicate directory entries were not necessarily getting found and fixed for non-indexed directories, since we were sorting these directories by inode number, and the duplicate entry code assumed the entries were getting sorted by name or directory name hash. Addresses-Sourceforge-Bug: #2862551 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>bitmap-optimize
parent
c7cd908be5
commit
b71e01835f
|
@ -751,12 +751,7 @@ errcode_t e2fsck_rehash_dir(e2fsck_t ctx, ext2_ino_t ino)
|
||||||
|
|
||||||
/* Sort the list */
|
/* Sort the list */
|
||||||
resort:
|
resort:
|
||||||
if (fd.compress)
|
qsort(fd.harray, fd.num_array, sizeof(struct hash_entry), hash_cmp);
|
||||||
qsort(fd.harray+2, fd.num_array-2,
|
|
||||||
sizeof(struct hash_entry), ino_cmp);
|
|
||||||
else
|
|
||||||
qsort(fd.harray, fd.num_array,
|
|
||||||
sizeof(struct hash_entry), hash_cmp);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Look for duplicates
|
* Look for duplicates
|
||||||
|
@ -769,6 +764,11 @@ resort:
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sort non-hashed directories by inode number */
|
||||||
|
if (fd.compress)
|
||||||
|
qsort(fd.harray+2, fd.num_array-2,
|
||||||
|
sizeof(struct hash_entry), ino_cmp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy the directory entries. In a htree directory these
|
* Copy the directory entries. In a htree directory these
|
||||||
* will become the leaf nodes.
|
* will become the leaf nodes.
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
Pass 1: Checking inodes, blocks, and sizes
|
||||||
|
Pass 2: Checking directory structure
|
||||||
|
Duplicate entry 'test-008' found.
|
||||||
|
Marking / (2) to be rebuilt.
|
||||||
|
|
||||||
|
Pass 3: Checking directory connectivity
|
||||||
|
Pass 3A: Optimizing directories
|
||||||
|
Entry 'test-008' in / (2) has a non-unique filename.
|
||||||
|
Rename to test-0~0? yes
|
||||||
|
|
||||||
|
Pass 4: Checking reference counts
|
||||||
|
Pass 5: Checking group summary information
|
||||||
|
|
||||||
|
test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
|
||||||
|
test_filesys: 21/256 files (0.0% non-contiguous), 1087/2048 blocks
|
||||||
|
Exit status is 1
|
|
@ -0,0 +1,7 @@
|
||||||
|
Pass 1: Checking inodes, blocks, and sizes
|
||||||
|
Pass 2: Checking directory structure
|
||||||
|
Pass 3: Checking directory connectivity
|
||||||
|
Pass 4: Checking reference counts
|
||||||
|
Pass 5: Checking group summary information
|
||||||
|
test_filesys: 21/256 files (0.0% non-contiguous), 1087/2048 blocks
|
||||||
|
Exit status is 0
|
Binary file not shown.
|
@ -0,0 +1 @@
|
||||||
|
duplicate directory entries for non-indexed dirs
|
Loading…
Reference in New Issue