Whamcloud - gitweb
e4defrag: handle device symlinks
authorEric Sandeen <sandeen@redhat.com>
Sat, 28 Jul 2012 21:48:36 +0000 (17:48 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 28 Jul 2012 21:53:48 +0000 (17:53 -0400)
commit032eafee3007001d07ee1798db6166a0031a3601
tree50b713bda1a3f4b6b6a36ade8b095ad3459b4576
parent339e457939bf1663ac2dbd52e47cd6e145726771
e4defrag: handle device symlinks

Device nodes are commonly accessed via symlinks, i.e.

lrwxrwxrwx. 1 root root 7 Jul 19 13:01 /dev/mapper/testvg-testlv -> ../dm-0

Today, e4defrag on such a device will fail:

File is not regular file
 "/dev/mapper/testvg-testlv"

due to it being a link, and e4defrag on the link target does as well:

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.

Addresses-Red-Hat-Bugzilla: #707209

Reported-by: Peter Hjalmarsson <xake@rymdraket.net>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
27 files changed:
misc/e4defrag.c
po/ca.gmo
po/ca.po
po/cs.gmo
po/cs.po
po/de.gmo
po/de.po
po/es.gmo
po/es.po
po/fr.gmo
po/fr.po
po/id.gmo
po/id.po
po/it.gmo
po/it.po
po/nl.gmo
po/nl.po
po/pl.gmo
po/pl.po
po/sv.gmo
po/sv.po
po/tr.gmo
po/tr.po
po/vi.gmo
po/vi.po
po/zh_CN.gmo
po/zh_CN.po