-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
btrfs-progs: remove loopback device resolution
[BUG] mkfs.btrfs has a built-in loopback device resolution, to avoid the same file being added to the same fs, using loopback device and the file itself. But it has one big bug: - It doesn't detect partition on loopback devices correctly The function is_loop_device() only utilize major number to detect a loopback device. But partitions on loopback devices doesn't use the same major number as the loopback device: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 5G 0 loop |-loop0p1 259:3 0 128M 0 part `-loop0p2 259:4 0 4.9G 0 part Thus `/dev/loop0p1` will not be treated as a loopback device, thus it will not even resolve the source file. And this can not even be fixed, as if we do extra "/dev/loop*" based file lookup, `/dev/loop0p1` and `/dev/loop0p2` will resolve to the same source file, and refuse to mkfs on two different partitions. [FIX] The loopback file detection is the baby sitting that no one asks for. Just as I explained, it only brings new bugs, and we will never fix all ways that an experienced user can come up with. And I didn't see any other mkfs tool doing such baby sitting. So remove the loopback file resolution, just regular is_same_blk_file() is good enough. Signed-off-by: Qu Wenruo <[email protected]>
- Loading branch information
1 parent
c5e723b
commit 6094201
Showing
3 changed files
with
5 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters