Skip to contentSkip to conversation

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

PATCH New Jaegeuk Kim 1 participant 1 message Feb 22, 2016 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 lib/libf2fs.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
lib/libf2fs.c +6 -6
index d61eb85..5eb5c33 100644
@@ -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;
Signature · 9 lines
2.6.3


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140