[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211118235744.802584-7-krisman@collabora.com>
Date: Thu, 18 Nov 2021 18:57:41 -0500
From: Gabriel Krisman Bertazi <krisman@...labora.com>
To: pvorel@...e.cz, jack@...e.com, amir73il@...il.com,
repnop@...gle.com
Cc: linux-ext4@...r.kernel.org, kernel@...labora.com,
khazhy@...gle.com, ltp@...ts.linux.it,
Gabriel Krisman Bertazi <krisman@...labora.com>
Subject: [PATCH v4 6/9] syscalls/fanotify22: Support submission of debugfs commands
In order to test FAN_FS_ERROR, we want to corrupt the filesystem. The
easiest way to do it is by using debugfs. Add a small helper to issue
debugfs requests. Since most likely this will be the only testcase to
need this, don't bother making it a proper helper for now.
Reviewed-by: Amir Goldstein <amir73il@...il.com>
Signed-off-by: Gabriel Krisman Bertazi <krisman@...labora.com>
---
changes since v1:
- Add .needs_cmds to require debugfs
---
testcases/kernel/syscalls/fanotify/fanotify22.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/syscalls/fanotify/fanotify22.c b/testcases/kernel/syscalls/fanotify/fanotify22.c
index eeee582f1268..bb44ed55e96e 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify22.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify22.c
@@ -49,6 +49,13 @@ static void trigger_fs_abort(void)
MS_REMOUNT|MS_RDONLY, "abort");
}
+static void do_debugfs_request(const char *dev, char *request)
+{
+ const char *cmd[] = {"debugfs", "-w", dev, "-R", request, NULL};
+
+ SAFE_CMD(cmd, NULL, NULL);
+}
+
static struct test_case {
char *name;
int error;
@@ -227,7 +234,11 @@ static struct tst_test test = {
.mount_device = 1,
.mntpoint = MOUNT_PATH,
.needs_root = 1,
- .dev_fs_type = "ext4"
+ .dev_fs_type = "ext4",
+ .needs_cmds = (const char *[]) {
+ "debugfs",
+ NULL
+ }
};
#else
--
2.33.0
Powered by blists - more mailing lists