libf2fs: increase robustness when called on root device
authorTobias Jakobi <tjakobi@math.uni-bielefeld.de>
Wed, 28 Sep 2016 17:28:03 +0000 (19:28 +0200)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 28 Sep 2016 22:26:54 +0000 (15:26 -0700)
commite5b3ec89eec84e9d073788e6169b464169305026
tree8ff2fac68b17b6de0bc490cd8deed58900cd1476
parentf1ee35104dbc6279e52c9cf389acaeb12ac0c126
libf2fs: increase robustness when called on root device

On some systems '/proc/mounts' contains the entry '/dev/root'
as alias for the root device, while that alias doesn't actually
exist as symlink in /dev.

/proc/mounts:
/dev/root / f2fs rw,noatime,background_gc=on,user_xattr,acl,inline_data,extent_cache,active_logs=6 0 0

mount:
/dev/mmcblk1p1 on / type f2fs (rw,noatime,background_gc=on,user_xattr,acl,inline_data,extent_cache,active_logs=6)

If the root device is mounted RO, and we try to scan it, via
'fsck.f2fs /dev/mmcblk1p1', then fsck.f2fs exits because it can't
find the entry in /proc/mounts.

Try harder to identify the root device of the system first, and
in case we are operating on it, check also for '/dev/root' in mounts.

Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
include/f2fs_fs.h
lib/libf2fs.c