All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@collabora.com>
To: jack@suse.com, amir73il@gmail.com, repnop@google.com
Cc: ltp@lists.linux.it, khazhy@google.com, kernel@collabora.com,
	linux-ext4@vger.kernel.org,
	Gabriel Krisman Bertazi <krisman@collabora.com>
Subject: [PATCH v3 6/9] syscalls/fanotify21: Support submission of debugfs commands
Date: Fri, 29 Oct 2021 18:17:29 -0300	[thread overview]
Message-ID: <20211029211732.386127-7-krisman@collabora.com> (raw)
In-Reply-To: <20211029211732.386127-1-krisman@collabora.com>

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@gmail.com>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
changes since v1:
  - Add .needs_cmds to require debugfs
---
 testcases/kernel/syscalls/fanotify/fanotify21.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/fanotify/fanotify21.c b/testcases/kernel/syscalls/fanotify/fanotify21.c
index 95c988821a34..43e606c27372 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify21.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify21.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;
@@ -228,7 +235,11 @@ static struct tst_test test = {
 	.mntpoint = MOUNT_PATH,
 	.all_filesystems = 0,
 	.needs_root = 1,
-	.dev_fs_type = "ext4"
+	.dev_fs_type = "ext4",
+	.needs_cmds = (const char *[]) {
+		"debugfs",
+		NULL
+	}
 };
 
 #else
-- 
2.33.0


WARNING: multiple messages have this Message-ID (diff)
From: Gabriel Krisman Bertazi <krisman@collabora.com>
To: jack@suse.com, amir73il@gmail.com, repnop@google.com
Cc: linux-ext4@vger.kernel.org, kernel@collabora.com,
	Gabriel Krisman Bertazi <krisman@collabora.com>,
	khazhy@google.com, ltp@lists.linux.it
Subject: [LTP] [PATCH v3 6/9] syscalls/fanotify21: Support submission of debugfs commands
Date: Fri, 29 Oct 2021 18:17:29 -0300	[thread overview]
Message-ID: <20211029211732.386127-7-krisman@collabora.com> (raw)
In-Reply-To: <20211029211732.386127-1-krisman@collabora.com>

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@gmail.com>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
changes since v1:
  - Add .needs_cmds to require debugfs
---
 testcases/kernel/syscalls/fanotify/fanotify21.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/fanotify/fanotify21.c b/testcases/kernel/syscalls/fanotify/fanotify21.c
index 95c988821a34..43e606c27372 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify21.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify21.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;
@@ -228,7 +235,11 @@ static struct tst_test test = {
 	.mntpoint = MOUNT_PATH,
 	.all_filesystems = 0,
 	.needs_root = 1,
-	.dev_fs_type = "ext4"
+	.dev_fs_type = "ext4",
+	.needs_cmds = (const char *[]) {
+		"debugfs",
+		NULL
+	}
 };
 
 #else
-- 
2.33.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2021-10-29 21:18 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29 21:17 [PATCH v3 0/9] Test the new fanotify FAN_FS_ERROR event Gabriel Krisman Bertazi
2021-10-29 21:17 ` [LTP] " Gabriel Krisman Bertazi
2021-10-29 21:17 ` [PATCH v3 1/9] syscalls: fanotify: Add macro to require specific mark types Gabriel Krisman Bertazi
2021-10-29 21:17   ` [LTP] " Gabriel Krisman Bertazi
2021-11-02 11:27   ` Matthew Bobrowski
2021-11-02 11:27     ` [LTP] " Matthew Bobrowski via ltp
2021-11-02 12:13     ` Amir Goldstein
2021-11-02 12:13       ` [LTP] " Amir Goldstein
2021-11-03 16:13       ` Petr Vorel
2021-11-03 16:13         ` Petr Vorel
2021-10-29 21:17 ` [PATCH v3 2/9] syscalls: fanotify: Add macro to require specific events Gabriel Krisman Bertazi
2021-10-29 21:17   ` [LTP] " Gabriel Krisman Bertazi
2021-10-30  6:11   ` Amir Goldstein
2021-10-30  6:11     ` [LTP] " Amir Goldstein
2021-11-02 11:58   ` Matthew Bobrowski
2021-11-02 11:58     ` [LTP] " Matthew Bobrowski via ltp
2021-11-02 12:11     ` Amir Goldstein
2021-11-02 12:11       ` [LTP] " Amir Goldstein
2021-10-29 21:17 ` [PATCH v3 3/9] syscalls/fanotify21: Introduce FAN_FS_ERROR test Gabriel Krisman Bertazi
2021-10-29 21:17   ` [LTP] " Gabriel Krisman Bertazi
2021-10-30  6:15   ` Amir Goldstein
2021-10-30  6:15     ` [LTP] " Amir Goldstein
2021-11-05  8:59     ` Petr Vorel
2021-11-05  8:59       ` Petr Vorel
2021-10-29 21:17 ` [PATCH v3 4/9] syscalls/fanotify21: Validate the generic error info Gabriel Krisman Bertazi
2021-10-29 21:17   ` [LTP] " Gabriel Krisman Bertazi
2021-10-29 21:17 ` [PATCH v3 5/9] syscalls/fanotify21: Validate incoming FID in FAN_FS_ERROR Gabriel Krisman Bertazi
2021-10-29 21:17   ` [LTP] " Gabriel Krisman Bertazi
2021-11-05  9:49   ` Petr Vorel
2021-11-05  9:49     ` Petr Vorel
2021-10-29 21:17 ` Gabriel Krisman Bertazi [this message]
2021-10-29 21:17   ` [LTP] [PATCH v3 6/9] syscalls/fanotify21: Support submission of debugfs commands Gabriel Krisman Bertazi
2021-10-29 21:17 ` [PATCH v3 7/9] syscalls/fanotify21: Create a corrupted file Gabriel Krisman Bertazi
2021-10-29 21:17   ` [LTP] " Gabriel Krisman Bertazi
2021-10-29 21:17 ` [PATCH v3 8/9] syscalls/fanotify21: Test file event with broken inode Gabriel Krisman Bertazi
2021-10-29 21:17   ` [LTP] " Gabriel Krisman Bertazi
2021-10-29 21:17 ` [PATCH v3 9/9] syscalls/fanotify21: Test capture of multiple errors Gabriel Krisman Bertazi
2021-10-29 21:17   ` [LTP] " Gabriel Krisman Bertazi
2021-10-30  6:21 ` [PATCH v3 0/9] Test the new fanotify FAN_FS_ERROR event Amir Goldstein
2021-10-30  6:21   ` [LTP] " Amir Goldstein
2021-11-05 10:10 ` Petr Vorel
2021-11-05 10:10   ` Petr Vorel
2021-11-05 13:02   ` Amir Goldstein
2021-11-05 13:02     ` Amir Goldstein
2021-11-05 13:10     ` Petr Vorel
2021-11-05 13:10       ` Petr Vorel
2021-11-15 21:26 ` Petr Vorel
2021-11-15 21:26   ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211029211732.386127-7-krisman@collabora.com \
    --to=krisman@collabora.com \
    --cc=amir73il@gmail.com \
    --cc=jack@suse.com \
    --cc=kernel@collabora.com \
    --cc=khazhy@google.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=ltp@lists.linux.it \
    --cc=repnop@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.