{"id":2223905,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2223905/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/patch/20260416112611.23057-1-wegao@suse.com/","project":{"id":59,"url":"http://patchwork.ozlabs.org/api/1.2/projects/59/?format=json","name":"Linux Test Project development","link_name":"ltp","list_id":"ltp.lists.linux.it","list_email":"ltp@lists.linux.it","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260416112611.23057-1-wegao@suse.com>","list_archive_url":null,"date":"2026-04-16T11:25:58","name":"[v5] fsconfig04: Check FSCONFIG_SET_PATH","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"cdf137513d219e2a5c20ec7617165d5bf6a37c45","submitter":{"id":85577,"url":"http://patchwork.ozlabs.org/api/1.2/people/85577/?format=json","name":"Wei Gao","email":"wegao@suse.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ltp/patch/20260416112611.23057-1-wegao@suse.com/mbox/","series":[{"id":500136,"url":"http://patchwork.ozlabs.org/api/1.2/series/500136/?format=json","web_url":"http://patchwork.ozlabs.org/project/ltp/list/?series=500136","date":"2026-04-16T11:25:58","name":"[v5] fsconfig04: Check FSCONFIG_SET_PATH","version":5,"mbox":"http://patchwork.ozlabs.org/series/500136/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223905/comments/","check":"warning","checks":"http://patchwork.ozlabs.org/api/patches/2223905/checks/","tags":{},"related":[],"headers":{"Return-Path":"<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>","X-Original-To":["incoming@patchwork.ozlabs.org","ltp@lists.linux.it"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","ltp@picard.linux.it"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=lists.linux.it header.i=@lists.linux.it\n header.a=rsa-sha256 header.s=picard header.b=FuynHfMC;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=suse.com header.i=@suse.com header.a=rsa-sha256\n header.s=google header.b=MNPHrdMf;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=213.254.12.146; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)"],"Received":["from picard.linux.it (picard.linux.it [213.254.12.146])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fxG1G6jfCz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 21:26:26 +1000 (AEST)","from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id 111513E2DEF\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 13:26:24 +0200 (CEST)","from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it\n [IPv6:2001:4b78:1:20::3])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id 9ED9A3C2B4B\n for <ltp@lists.linux.it>; Thu, 16 Apr 2026 13:26:20 +0200 (CEST)","from mail-wr1-x429.google.com (mail-wr1-x429.google.com\n [IPv6:2a00:1450:4864:20::429])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-3.smtp.seeweb.it (Postfix) with ESMTPS id 9A9531A0092D\n for <ltp@lists.linux.it>; Thu, 16 Apr 2026 13:26:19 +0200 (CEST)","by mail-wr1-x429.google.com with SMTP id\n ffacd0b85a97d-43d74086e5bso3364269f8f.0\n for <ltp@lists.linux.it>; Thu, 16 Apr 2026 04:26:19 -0700 (PDT)","from localhost ([2a07:de40:b240:0:2ad6:ed42:2ad6:ed42])\n by smtp.gmail.com with UTF8SMTPSA id\n ffacd0b85a97d-43ead3566c4sm12743680f8f.12.2026.04.16.04.26.17\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 16 Apr 2026 04:26:17 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=lists.linux.it;\n i=@lists.linux.it; q=dns/txt; s=picard; t=1776338784; h=to : date :\n message-id : in-reply-to : references : mime-version : subject :\n list-id : list-unsubscribe : list-archive : list-post : list-help :\n list-subscribe : from : reply-to : content-type :\n content-transfer-encoding : sender : from;\n bh=+mhcB/SkIG7RmvHMpEiBgi78RmE4oDf+V0VH+IIhBxQ=;\n b=FuynHfMCBFXo+EDlEw2mJCVEWwZJDEFOR42EJWw0+S4QG+bfUUbCp6pbZiEnsV87RBF9n\n MT1v3KmUBuB0VIn5GIS58OGvBHHmS/MBoS5Os4ZyhzvdWIkVVnwUpObRdC1AHJsXSx4BzQG\n vo/wMndHDNRaceeH/I5CmJEfvlfqUSI=","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=suse.com; s=google; t=1776338779; x=1776943579; darn=lists.linux.it;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=8qTQJic27eWPz14TlxJYC4n/tX7dzDHs49m85C3eqfg=;\n b=MNPHrdMfOG0WKJD/INvI678v4TS7QBbojwqRul0FKHj2pzvIyk8ftGRJXc1ADrtKF1\n 3dDaFdDo1zDZeuyFt3QS9DGsfO1uflnAF2Mleavx8hvEAxY1ZveunlbyNcL0Virs9kdW\n i6ZczkDsv1gB+X5itaE1g3fsD2gZINukyUxQjxUlxR2Nx7d9Cafj/KVbvuxDPWLvHm2a\n ljqdWV5LWEoRmDL7FxRVMhCxthGe3H9Pex30jqkc8Nt6egLGoj9TbKc3ypNPNUAPkSzt\n t7oRavioGyEjT7/k1NbjMCkKVE2TvLQj0NSv/9IkYLW3aNmktCYrkhG4lKNyqlXASzRh\n jnYw=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776338779; x=1776943579;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=8qTQJic27eWPz14TlxJYC4n/tX7dzDHs49m85C3eqfg=;\n b=KuwakDJQ6uS1gtedpgOqD79wNZALLK9fCkR7zSEAeb/JmZmJYup632GRHcIdDzFphE\n ZJ6CGxzuBx7Jh+xtAjUpcgDBkjR5MIoW72Ss7YZNjv6+EefSJoVT5XWnZWfmcB/vZ8uR\n DGkja7no//jgZaTVBRFKx7vv6nEhmXf6lKO6BRaADImleNJZVgb6rO8cZ+okpO+2Obr1\n ExQy2UAyJUklzQkODGa6pY2u+ia99UwojkvtZkmLzaQYWT5BurfATnQswLZJFVmHoofO\n 2NSfryZKLTMazyXoz+0UDTHS6Ugb04vMJPwESzdPDtsK02Un8Dt4mBGdOZ7Tc1AXek6Z\n EFvg==","X-Gm-Message-State":"AOJu0YyqHFZw04JJA/WObpHezUpjsWQgr8BppIy0jg+s4LUDlPsjtida\n aLReHZ4RnNtQqMg8PUYDvkk4H8K5KconJyjqZE3bx4zE4jElRgyK+eVy/mb5s7rzd9ctB0m9eFs\n 5OZw=","X-Gm-Gg":"AeBDieuVzPVPLIi7vSze2IKjiD+C2cWR/pPotrzx9enuZ4oC9hGHhkJf98HFyQi5Edv\n +PwmrJEIw9zZFsMp6+h2aeupDHBgyuXjJcEXlj31ppPZjnvKK3xwr9L/P+IN2FKwOeaIg6c7Gtc\n 7oTRZLjM0GmoXhVBurNmTRFMY/CtdYxlB75CzRxAQZTdlwdwoXrNOrOMh0lGr/m3DKbrelwhKPV\n wn7/ZPe0ColU7yN9ssOgxgUs9idPma1qKFgF4zt6teYqaIOqsumjY8I7mmWp4W9C6LAtH1dBWmt\n pAgzBxahpR3f3PQPx5aoz4GnI3T2jjvlhFqd88xtmFl5sK35LONoAzAw7F1NSzh1gVhzSQwZLqt\n v14dPL+PyYpJbc60Pfts+zWEw9d3V8/Y1SbSOs6P2LQYL4g0h5wRtWsjd6j2HMenNg79yP0zs3B\n sGztyepEOCNwY=","X-Received":"by 2002:a05:6000:4283:b0:43d:d037:d59c with SMTP id\n ffacd0b85a97d-43dd037d5dfmr18184859f8f.16.1776338778385;\n Thu, 16 Apr 2026 04:26:18 -0700 (PDT)","To":"ltp@lists.linux.it","Date":"Thu, 16 Apr 2026 11:25:58 +0000","Message-ID":"<20260416112611.23057-1-wegao@suse.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20260410054750.18283-1-wegao@suse.com>","References":"<20260410054750.18283-1-wegao@suse.com>","MIME-Version":"1.0","X-Spam-Status":"No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on in-3.smtp.seeweb.it","X-Virus-Scanned":"clamav-milter 1.0.9 at in-3.smtp.seeweb.it","X-Virus-Status":"Clean","Subject":"[LTP] [PATCH v5] fsconfig04: Check FSCONFIG_SET_PATH","X-BeenThere":"ltp@lists.linux.it","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"Linux Test Project <ltp.lists.linux.it>","List-Unsubscribe":"<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>","List-Archive":"<http://lists.linux.it/pipermail/ltp/>","List-Post":"<mailto:ltp@lists.linux.it>","List-Help":"<mailto:ltp-request@lists.linux.it?subject=help>","List-Subscribe":"<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>","From":"Wei Gao via ltp <ltp@lists.linux.it>","Reply-To":"Wei Gao <wegao@suse.com>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it","Sender":"\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"},"content":"The fsconfig01.c does not test if FSCONFIG_SET_PATH have any effect,\nmost of the calls there just set dummy \"sync\" parameter. This test\ncase aims to verify if the FSCONFIG_SET_PATH operation can be used\nto dynamically change the external journal device of ext3 or ext4\nfilesystem.\n\nFixes: https://github.com/linux-test-project/ltp/issues/1169\nSigned-off-by: Wei Gao <wegao@suse.com>\n---\nv4->v5:\n   1. Fixed lowercase hex issue in device_str to match tune2fs output.\n   2. Initialized fd = -1 and improved cleanup() with safety guards.\n   3. Used PATH_MAX and snprintf() for safe path handling.\n   4. Updated needs_cmds to the modern struct tst_cmd format.\n   5. Restored TST_EXP_PASS_SILENT for device detachment.\n   6. Renamed \"workarounds\" to \"Implementation notes\".\n\n runtest/syscalls                              |   1 +\n testcases/kernel/syscalls/fsconfig/.gitignore |   1 +\n .../kernel/syscalls/fsconfig/fsconfig04.c     | 168 ++++++++++++++++++\n 3 files changed, 170 insertions(+)\n create mode 100644 testcases/kernel/syscalls/fsconfig/fsconfig04.c","diff":"diff --git a/runtest/syscalls b/runtest/syscalls\nindex 5025b259f..84adf4fad 100644\n--- a/runtest/syscalls\n+++ b/runtest/syscalls\n@@ -422,6 +422,7 @@ fremovexattr02 fremovexattr02\n fsconfig01 fsconfig01\n fsconfig02 fsconfig02\n fsconfig03 fsconfig03\n+fsconfig04 fsconfig04\n \n fsmount01 fsmount01\n fsmount02 fsmount02\ndiff --git a/testcases/kernel/syscalls/fsconfig/.gitignore b/testcases/kernel/syscalls/fsconfig/.gitignore\nindex cfedae5f7..bd3754c34 100644\n--- a/testcases/kernel/syscalls/fsconfig/.gitignore\n+++ b/testcases/kernel/syscalls/fsconfig/.gitignore\n@@ -1,3 +1,4 @@\n /fsconfig01\n /fsconfig02\n /fsconfig03\n+/fsconfig04\ndiff --git a/testcases/kernel/syscalls/fsconfig/fsconfig04.c b/testcases/kernel/syscalls/fsconfig/fsconfig04.c\nnew file mode 100644\nindex 000000000..188322a4c\n--- /dev/null\n+++ b/testcases/kernel/syscalls/fsconfig/fsconfig04.c\n@@ -0,0 +1,168 @@\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Copyright (c) 2026 Wei Gao <wegao@suse.com>\n+ */\n+\n+/*\\\n+ * This test aims to validate the functionality of fsconfig(FSCONFIG_SET_PATH) in\n+ * dynamically altering the external journal device of a ext3 or ext4 filesystem.\n+ * Case acquires three loop devices (dev0, dev1, dev2), it formats dev1 and dev2\n+ * as external journal devices using the -O journal_dev option and assigns them\n+ * the same UUID. Then formats dev0 (the main filesystem) multiple times, first\n+ * associating it with dev1, then change to dev2, finally back to dev1 again as\n+ * an external journal using the -J device= option.\n+ *\n+ * 2 Implementation notes in this case need mention:\n+ *\n+ * - To avoid \"journal UUID does not match\" error when switch external journal device\n+ *   we have to assign same UUID to dev1/dev2\n+ * - Before fsconfig test we have to format dev0 associating to dev1->dev2->dev1,\n+ *   this will make sure both dev1/2's super block contain correct content. Otherwise\n+ *   you will encounter error such as \"EXT4-fs (loop0): External journal has more than\n+ *   one user (unsupported) - 0\" when switch external journal device using fsconfig.\n+ */\n+\n+#include \"tst_test.h\"\n+#include \"tst_safe_stdio.h\"\n+#include \"lapi/fsmount.h\"\n+#include \"old/tso_device.h\"\n+\n+#define MNTPOINT\t\"mntpoint\"\n+#define LOOP_DEV_SIZE 10\n+#define UUID \"d73c9e5e-97e4-4a9c-b17e-75a931b02660\"\n+\n+static int fd = -1;\n+static char dev0[PATH_MAX];\n+static char dev1[PATH_MAX];\n+static char dev2[PATH_MAX];\n+\n+static void cleanup(void)\n+{\n+\tif (fd != -1)\n+\t\tSAFE_CLOSE(fd);\n+\n+\tif (dev1[0])\n+\t\ttst_detach_device(dev1);\n+\n+\tif (dev2[0])\n+\t\ttst_detach_device(dev2);\n+}\n+\n+static void setup(void)\n+{\n+\tconst char *dev;\n+\n+\tstrcpy(dev0, tst_device->dev);\n+\tdev = tst_acquire_loop_device(LOOP_DEV_SIZE, \"dev1_file\");\n+\tif (!dev)\n+\t\ttst_brk(TBROK, \"acquire loop dev1 failed\");\n+\n+\tstrcpy(dev1, dev);\n+\tdev = NULL;\n+\n+\tdev = tst_acquire_loop_device(LOOP_DEV_SIZE, \"dev2_file\");\n+\tif (!dev)\n+\t\ttst_brk(TBROK, \"acquire loop dev2 failed\");\n+\tstrcpy(dev2, dev);\n+\n+\tconst char *const *mkfs_opts_set_UUID;\n+\tconst char *const *mkfs_opts_set_journal_dev1;\n+\tconst char *const *mkfs_opts_set_journal_dev2;\n+\n+\tmkfs_opts_set_UUID = (const char *const []) {\"-F\", \"-U\", UUID,\n+\t\t\"-O\", \"journal_dev\", NULL};\n+\n+\tchar device_option_dev1[PATH_MAX];\n+\tchar device_option_dev2[PATH_MAX];\n+\n+\tsnprintf(device_option_dev1, sizeof(device_option_dev1), \"device=%s\", dev1);\n+\tsnprintf(device_option_dev2, sizeof(device_option_dev2), \"device=%s\", dev2);\n+\n+\tmkfs_opts_set_journal_dev1 = (const char *const []) {\"-F\", \"-J\",\n+\t\tdevice_option_dev1, NULL};\n+\n+\tmkfs_opts_set_journal_dev2 = (const char *const []) {\"-F\", \"-J\",\n+\t\tdevice_option_dev2, NULL};\n+\n+\tSAFE_MKFS(dev1, tst_device->fs_type, mkfs_opts_set_UUID, NULL);\n+\tSAFE_MKFS(dev2, tst_device->fs_type, mkfs_opts_set_UUID, NULL);\n+\tSAFE_MKFS(dev0, tst_device->fs_type, mkfs_opts_set_journal_dev1, NULL);\n+\tSAFE_MKFS(dev0, tst_device->fs_type, mkfs_opts_set_journal_dev2, NULL);\n+\tSAFE_MKFS(dev0, tst_device->fs_type, mkfs_opts_set_journal_dev1, NULL);\n+}\n+\n+static void run(void)\n+{\n+\tTEST(fd = fsopen(tst_device->fs_type, 0));\n+\tif (fd == -1)\n+\t\ttst_brk(TBROK | TTERRNO, \"fsopen() failed\");\n+\n+\tTEST(fsconfig(fd, FSCONFIG_SET_STRING, \"source\", dev0, 0));\n+\tif (TST_RET == -1)\n+\t\ttst_brk(TFAIL | TTERRNO, \"fsconfig(FSCONFIG_SET_STRING) failed\");\n+\n+\tTEST(fsconfig(fd, FSCONFIG_SET_PATH, \"journal_path\", dev2, 0));\n+\tif (TST_RET == -1) {\n+\t\tif (TST_ERR == EOPNOTSUPP)\n+\t\t\ttst_brk(TCONF, \"fsconfig(FSCONFIG_SET_PATH) not supported\");\n+\t\telse\n+\t\t\ttst_brk(TFAIL | TTERRNO, \"fsconfig(FSCONFIG_SET_PATH) failed\");\n+\t}\n+\n+\tTEST(fsconfig(fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0));\n+\tif (TST_RET == -1)\n+\t\ttst_brk(TFAIL | TTERRNO, \"fsconfig(FSCONFIG_CMD_CREATE) failed\");\n+\n+\tchar loop_name[NAME_MAX];\n+\tchar path[PATH_MAX];\n+\tchar device_str[NAME_MAX];\n+\tunsigned int major, minor, device_num;\n+\tunsigned int found = 0;\n+\n+\tSAFE_SSCANF(dev2, \"/dev/%s\", loop_name);\n+\n+\tsnprintf(path, sizeof(path), \"/sys/block/%s/dev\", loop_name);\n+\tSAFE_FILE_SCANF(path, \"%u:%u\", &major, &minor);\n+\tdevice_num = (major << 8) | minor;\n+\tsnprintf(device_str, sizeof(device_str), \"0x%04x\", device_num);\n+\n+\tchar line[PATH_MAX];\n+\tFILE *tune2fs;\n+\n+\tsnprintf(path, sizeof(path), \"tune2fs -l %s 2>&1\", dev0);\n+\ttune2fs = SAFE_POPEN(path, \"r\");\n+\n+\twhile (fgets(line, PATH_MAX, tune2fs)) {\n+\t\tif (*line && strstr(line, \"Journal device:\") && strstr(line, device_str)) {\n+\t\t\tfound = 1;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tif (found == 1)\n+\t\ttst_res(TPASS, \"Device found in journal\");\n+\telse\n+\t\ttst_res(TFAIL, \"Device not found in journal\");\n+\n+\tpclose(tune2fs);\n+\tSAFE_CLOSE(fd);\n+}\n+\n+static struct tst_test test = {\n+\t.test_all = run,\n+\t.setup = setup,\n+\t.cleanup = cleanup,\n+\t.needs_root = 1,\n+\t.needs_tmpdir = 1,\n+\t.format_device = 1,\n+\t.mntpoint = MNTPOINT,\n+\t.needs_cmds = (struct tst_cmd []) {\n+\t\t{.cmd = \"tune2fs\"},\n+\t\t{}\n+\t},\n+\t.filesystems = (struct tst_fs []) {\n+\t\t{.type = \"ext3\"},\n+\t\t{.type = \"ext4\"},\n+\t\t{}\n+\t},\n+};\n","prefixes":["v5"]}