Re: [PATCH] e4defrag: Handle device symlinks
From: Theodore Ts'o <tytso@mit.edu>
Date: 2012-07-28 21:54:13
From: Theodore Ts'o <tytso@mit.edu>
Date: 2012-07-28 21:54:13
On Thu, Jul 19, 2012 at 02:02:30PM -0500, Eric Sandeen wrote:
Device nodes are commonly accessed via symlinks, i.e. # ls -l /dev/mapper/testvg-testlv lrwxrwxrwx. 1 root root 7 Jul 19 13:01 /dev/mapper/testvg-testlv -> ../dm-0 Today, e4defrag on such a device will fail: # e4defrag -c /dev/mapper/testvg-testlv File is not regular file "/dev/mapper/testvg-testlv" due to it being a link, and e4defrag on the link target does as well: # e4defrag -c /dev/dm-0 Filesystem is not mounted due to the target not being found in /etc/mtab. Fix this by checking whether the symlink target is a block device and if so, using that device in main(), and also changing get_mount_point() to search for a matching device number, not device name. Signed-off-by: Eric Sandeen <redacted>
Thanks, applied. - Ted