aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2019-07-29 23:39:36 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2019-08-20 11:23:58 -0700
commit523e36856f208a9f673fc3d849f85741b4c50d48 (patch)
tree5bc4d7a7bafb26a46f8cbfb1c9e22ccf5f7bc113
parent81bad9d11ea5f728cfc815a3060583171c2b4d7d (diff)
downloadf2fs-tools-523e36856f208a9f673fc3d849f85741b4c50d48.tar.gz
dump.f2fs: allow to dump data on mounted device
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. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--lib/libf2fs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 88ab70f..0536e5c 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -818,7 +818,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 */
@@ -864,7 +864,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);