fsck.f2fs: check /proc/mounts first to detect readonly

Once f2fs_stop_checkpoint makes f2fs as readonly, only /proc/mounts shows
RDONLY whereas /etc/mtab does not.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
Jaegeuk Kim 2016-02-18 17:37:14 -08:00
parent f8bc97b333
commit 50aa77b1d3

View File

@ -530,17 +530,17 @@ int f2fs_dev_is_umounted(struct f2fs_configuration *c)
struct stat st_buf;
int ret = 0;
ret = is_mounted(MOUNTED, c->device_name);
/*
* try with /proc/mounts fist to detect RDONLY.
* f2fs_stop_checkpoint makes RO in /proc/mounts while RW in /etc/mtab.
*/
ret = is_mounted("/proc/mounts", c->device_name);
if (ret) {
MSG(0, "Info: Mounted device!\n");
return -1;
}
/*
* if failed due to /etc/mtab file not present
* try with /proc/mounts.
*/
ret = is_mounted("/proc/mounts", c->device_name);
ret = is_mounted(MOUNTED, c->device_name);
if (ret) {
MSG(0, "Info: Mounted device!\n");
return -1;