aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libf2fs.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index b1741bc..0eb1477 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -559,23 +559,23 @@ int f2fs_dev_is_umounted(struct f2fs_configuration *c)
struct stat st_buf;
int ret = 0;
-#ifdef __linux__
- 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;
}
-#endif
- /*
- * if failed due to /etc/mtab file not present
- * try with /proc/mounts.
- */
- ret = is_mounted("/proc/mounts", c->device_name);
+#ifdef __linux__
+ ret = is_mounted(MOUNTED, c->device_name);
if (ret) {
MSG(0, "Info: Mounted device!\n");
return -1;
}
+#endif
/*
* If f2fs is umounted with -l, the process can still use