Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp511327pxb; Fri, 29 Oct 2021 14:20:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSs7TO8Ed+3GwHuAVf5bmItWEEGkUwoYar1kyx4qPPvUbSkuNeKn7AAXdQRYh0awnevjdo X-Received: by 2002:a17:907:1c8e:: with SMTP id nb14mr152091ejc.392.1635542433726; Fri, 29 Oct 2021 14:20:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635542433; cv=none; d=google.com; s=arc-20160816; b=Zw2S2MBVtZ528ACZffcpkk+1YEFzTKofBSowOO6QGRT9DTfMJGscRSY+ILcYKuCSSz 10DeQYvaxCLK5umrxk7VK24nV/2qyUL/cQx2a7GXql2Uuju7cI2sopH56e1+K7wYWI/e 0OzF6z2gEGnjoM+AcSezS2Qjm9ELhEzB6cuxZ2n1EzAxXqgcePPXMUCUv3yohcUD+Qn6 CiwWurQqOKvbWw77ZcK7XQ1psT1Kx/mSHEF3DpuaSMg7WNISIgBd8+7ti+maZIi70ZnG AEBCOxsHn9luGRDPDPYv/Vu3YZnhku/2VrNwXq70hdFi8Oz0Jxza/tliquCwR5uVSGvy t60w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nRo0VJBOg025iol6QdH329e9hWyvO8usYDqKj6pPXpI=; b=HX2pqPO7MfTp9QjLpqJOpSa0iHVlLrRWeJmpPWsJ9+Em+66kSgMxA7sa4oralldnJb K7SXKWTIFZ+7/0lMA9TFwX7fV7fd3umJCkuk3CA7voqqycZDVE3BeNpdNvL8K25MvKP6 pLJJBstL0wPGzqIork5lEY8/I3MW0WibAOYwTUzZTurSfzkvVgF34FQuBdgufA7EWD2X ltEhFxsM7HczcPLUefvnn81ipWw1cvXaU4spZM583ZHR2aPmutyHTIAZ6ESIuXAmTw6g sk9p8HnEoTcsIGryF8zB9DtMsc9JQP3p0UVm7lCzlQBIk8hvDvEU+Z8mfyeKulxQoGvb 98OQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e9si16556445edz.482.2021.10.29.14.20.11; Fri, 29 Oct 2021 14:20:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230168AbhJ2VVA (ORCPT + 99 others); Fri, 29 Oct 2021 17:21:00 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58436 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231463AbhJ2VU7 (ORCPT ); Fri, 29 Oct 2021 17:20:59 -0400 Received: from localhost (unknown [IPv6:2804:14c:124:8a08::1002]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: krisman) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 8149D1F45C6F; Fri, 29 Oct 2021 22:18:29 +0100 (BST) From: Gabriel Krisman Bertazi 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 Subject: [PATCH v3 6/9] syscalls/fanotify21: Support submission of debugfs commands Date: Fri, 29 Oct 2021 18:17:29 -0300 Message-Id: <20211029211732.386127-7-krisman@collabora.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211029211732.386127-1-krisman@collabora.com> References: <20211029211732.386127-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 Signed-off-by: Gabriel Krisman Bertazi --- 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