In the earlier version of btrfs-progs, mkfs.btrfs doesn't support -f option. So it should be judged in advance before the command is called.
Signed-off-by: Xing Gu <[email protected]> --- lib/tst_mkfs.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/tst_mkfs.c b/lib/tst_mkfs.c index 7357cd9..92b4b54 100644 --- a/lib/tst_mkfs.c +++ b/lib/tst_mkfs.c @@ -35,11 +35,19 @@ void tst_mkfs(void (cleanup_fn)(void), const char *dev, * superblock on the device, which is the case here as we * reuse one device for all tests. */ - if (!strcmp(fs_type, "xfs") || !strcmp(fs_type, "btrfs")) { + if (!strcmp(fs_type, "xfs")) { tst_resm(TINFO, "Appending '-f' flag to mkfs.%s", fs_type); argv[pos++] = "-f"; } + if (!strcmp(fs_type, "btrfs")) { + if (system("mkfs.btrfs 2>&1 | grep '\\-f ' >/dev/null") == 0) { + tst_resm(TINFO, "Appending '-f' flag to mkfs.%s", + fs_type); + argv[pos++] = "-f"; + } + } + if (fs_opts) { for (i = 0; fs_opts[i]; i++) { argv[pos++] = fs_opts[i]; -- 1.9.0 ------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
