Skip to contentSkip to conversation

dump.f2fs: allow to dump data on mounted device

PATCH New Chao Yu 1 participant 1 message Jul 29, 2019 Library code

lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 dump.f2fs: allow to dump data on mounted device

From: Chao Yu <[email protected]>

In generic/38[3456], we use quotactl(2) to check if prjquota is enabled on the given device (src/feature -P $dev in _require_prjquota), and quotactl(2) requires the given device is a mounted device.

So it requires dump.f2fs to list/check enabled features on a mounted device, let's relieve to allow such operation.

---
 lib/libf2fs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/libf2fs.c +2 -2
index 5ac07c1..7b65fa0 100644
@@ -845,7 +845,7 @@ void get_kernel_uname_version(__u8 *version)
 #ifndef ANDROID_WINDOWS_HOST
 static int open_check_fs(char *path, int flag)
 {
-	if (c.func != FSCK || c.fix_on || c.auto_fix)
+	if (c.func != DUMP && (c.func != FSCK || c.fix_on || c.auto_fix))
 		return -1;
 
 	/* allow to open ro */
@@ -891,7 +891,7 @@ int get_device_info(int i)
 			return -1;
 		}
 
-		if (S_ISBLK(stat_buf->st_mode) && !c.force) {
+		if (S_ISBLK(stat_buf->st_mode) && !c.force && c.func != DUMP) {
 			fd = open(dev->path, O_RDWR | O_EXCL);
 			if (fd < 0)
 				fd = open_check_fs(dev->path, O_EXCL);
Signature · 8 lines
2.22.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel