From patchwork Mon Dec 9 14:56:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schubert X-Patchwork-Id: 13899918 Received: from outbound-ip191b.ess.barracuda.com (outbound-ip191b.ess.barracuda.com [209.222.82.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA3591E9B3D; Mon, 9 Dec 2024 14:57:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.124 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756228; cv=fail; b=MMRjCecB5bC39jAHCWVw6W1/VIJAH8zB9hOUY8V0vtreuYSnOq0H/4SOkyCWhBGXMP9rTynivSjIF5A5CrQHz7XmB4wrSW9g7l9K1A6RHm089JS1/CnG867nfGzaUgQjUOIL0aCwLhD9N6nlocDExJ4qTTlKVJWbEJKgA8zlgfA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733756228; c=relaxed/simple; bh=MxfJjh+KWyLM/pBEqZ+TVduRkvAsbRDO2XTjnbrCNS8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MX2TPr/ue7/lOa0Chxa9/daQj2x0WqRwt6LTbZ9XuYGvHBMjzhD0s54JVnn9zlEkQMUvMNUwm0cQhMjKfnoHFAu+5vII9/x8ah1hLRwTPCC8smNrEfE/wJSSnLvIzFYPHvHxyyy1E6btXA7T/4anGMywYMd9Kn5DPnIZ2hGVjxs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com; spf=pass smtp.mailfrom=ddn.com; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b=HAnDkeqe; arc=fail smtp.client-ip=209.222.82.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ddn.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ddn.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ddn.com header.i=@ddn.com header.b="HAnDkeqe" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2049.outbound.protection.outlook.com [104.47.58.49]) by mx-outbound20-215.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 09 Dec 2024 14:56:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VreWllskI9zQcMoTtUgYj3u3cGiQC/Ue1wzWhOzB+80MeSFFDYi3pMFdW+A4K551pqeG9lez5+YPfLVzl+pj0dscBJKH30PBEUAp2xwH9I426/EFFsUOhOphn6N9tNCQcPkRdHJ+XaznJA0XK6YqFt8H9PhGvthpXQFF+U8KolVKm2DeXeeIflUhwr7pwxSKmiGgQB7yFHqnYN4s3JtUq0APOwIyvk1BRBadtqbs5O1oOlMXt26YSmKFmApo2aIJ8wfb2Ltd9tLQh1Ntq+lm1V3yGrM9+a3ez9Cc+6NsbSyHqijqy/EkX9L7eh99YhZotUUl9+bjoDKiALlU66dhtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ROJ/GyNgfYoF7z0FAlOmFhvKYoHCgYvO1Q08mJI7h60=; b=iZggkk+P/sS70iUXpk3uXg6xHWZEaWeFYx+UECZzRxemhvYj//q8R2wSZEMvMjuf/HZi02hFo2/HC33WVPcAGN401lHtiU3KYb1t1B+IuJNrMTcmUnmMuDQqE7SSdqrutb7OMa9PmpycH1N9sOZ5y8DuH9d/y1YmTMfGHaPa7QR4GVHlLQXhFx0TZhI/T2ptv2BaRoQFZLqHflbvXBdHDmycHTIsXeulsNZIRp5KjedCYnhZJ+bwnOxzBawOdtYQicTweWKIT955Uhn17CpAoe36xPECOPNchtBO7BKtlbXF2CBezPINEA3WMVw9mM3tnM2+kxJKyEuvKBjGSRrk9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 50.222.100.11) smtp.rcpttodomain=bsbernd.com smtp.mailfrom=ddn.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ddn.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ddn.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ROJ/GyNgfYoF7z0FAlOmFhvKYoHCgYvO1Q08mJI7h60=; b=HAnDkeqe+WMxv4eDWAnzmTwg85Y2fFl7KSuKjzaqW1U/S6xkTcduUBFGscl+uKSV2dEgHfTQtA9sPtvToEuiH9y+1ycnoqVNRM8snEhDuIA7WpEaj85qlKvJUEEE3x1SokBL5gbSVxIOFrjwIf2C0yJe1Q8Mkj89K9APWE22o6Q= Received: from PH7PR02CA0026.namprd02.prod.outlook.com (2603:10b6:510:33d::35) by MN0PR19MB6240.namprd19.prod.outlook.com (2603:10b6:208:3c4::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.24; Mon, 9 Dec 2024 14:56:46 +0000 Received: from MWH0EPF000A6734.namprd04.prod.outlook.com (2603:10b6:510:33d:cafe::b2) by PH7PR02CA0026.outlook.office365.com (2603:10b6:510:33d::35) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.13 via Frontend Transport; Mon, 9 Dec 2024 14:56:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 50.222.100.11) smtp.mailfrom=ddn.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ddn.com; Received-SPF: Pass (protection.outlook.com: domain of ddn.com designates 50.222.100.11 as permitted sender) receiver=protection.outlook.com; client-ip=50.222.100.11; helo=uww-mrp-01.datadirectnet.com; pr=C Received: from uww-mrp-01.datadirectnet.com (50.222.100.11) by MWH0EPF000A6734.mail.protection.outlook.com (10.167.249.26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 9 Dec 2024 14:56:45 +0000 Received: from localhost (unknown [10.68.0.8]) by uww-mrp-01.datadirectnet.com (Postfix) with ESMTP id A061B18B; Mon, 9 Dec 2024 14:56:44 +0000 (UTC) From: Bernd Schubert Date: Mon, 09 Dec 2024 15:56:27 +0100 Subject: [PATCH v8 05/16] fuse: make args->in_args[0] to be always the header Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241209-fuse-uring-for-6-10-rfc4-v8-5-d9f9f2642be3@ddn.com> References: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> In-Reply-To: <20241209-fuse-uring-for-6-10-rfc4-v8-0-d9f9f2642be3@ddn.com> To: Miklos Szeredi Cc: Jens Axboe , Pavel Begunkov , linux-fsdevel@vger.kernel.org, io-uring@vger.kernel.org, Joanne Koong , Josef Bacik , Amir Goldstein , Ming Lei , David Wei , bernd@bsbernd.com, Bernd Schubert X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1733756199; l=6974; i=bschubert@ddn.com; s=20240529; h=from:subject:message-id; bh=MxfJjh+KWyLM/pBEqZ+TVduRkvAsbRDO2XTjnbrCNS8=; b=7fWLyN6l2MTxNDNYXoY9+Qt1ao76sGHBRJgxOzipQ4Tjrqu1aF1Sai+NiTE8igWSzMa0ic5pl qgx4Cz2xA2TBdIrA4PDhhHODkjdCzaODt1j0696lbJehi9QyeVGu1sn X-Developer-Key: i=bschubert@ddn.com; a=ed25519; pk=EZVU4bq64+flgoWFCVQoj0URAs3Urjno+1fIq9ZJx8Y= X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A6734:EE_|MN0PR19MB6240:EE_ X-MS-Office365-Filtering-Correlation-Id: d18e5cef-1589-4a06-a786-08dd1861b341 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?r5L8kcFDPLVGof6EdQeSZC+2Nms2v1x?= =?utf-8?q?f/oDlMJhvg7S9orAeZNw6U5//VNJbGJmraCpTrzT5WEzTE1nQTSXuBMWFC0lnppsd?= =?utf-8?q?9uNLhxhBMbRFKbBN14KqsYzqckxBd57CFHjaq9erer0h5gP/djUP9Q0dgURrPYWjJ?= =?utf-8?q?FQObBwKC/RLlW9T3Jj5cqswxQFK+nWu1fDRfIlmpOxCbm7/yZPgjGydyaIKxZy11U?= =?utf-8?q?UHBhxHw50rCCTm2lWidbj2YlMIVF+vNrAUO15d07pQHo4WdQZH37udEaHGDQx7Jiy?= =?utf-8?q?lyEqQNcu/6OHMLsDl+rG+0XkCVaoVCPv8Bl4xUgegG+OmpPJkGBMGcERceZz4/Z6l?= =?utf-8?q?16BENaBTsc93oBI81vp7ALAPb5QkAvAMwwAP6U0oUUiJPsaMXrlEZ4TarZGwD/V+a?= =?utf-8?q?6yp9qafjwqmgHjBURk9kHIbYSRhn4/mtQZA2bytricPdwqniWL6ddCd7bugWrNyRm?= =?utf-8?q?xY6rVpR+BIoClknbmxB5F554FdIyGeV53/xoSn1eQajR9rbzVqdn+3G0jEbAAtS0W?= =?utf-8?q?IfvRaTK9kLwMOW74THT/+w30k98iGd4223i17Xd7Ru1gyGjdEfC/Hn/sUplxFRPs8?= =?utf-8?q?2J8pWsqnFdzUIjhHKfYrezjx1vAhjA70YOmICvgpxPCrOBNTSupQKWuLgHsQpfIYJ?= =?utf-8?q?3tZauuQgOkiJzfR1yoXrQTGj9VrnPkQnI9UD3aauVpXoiIDo+W+OXujN1EDD1sRRd?= =?utf-8?q?zJViEoS8jwJQyycKZuBYCvQhmd8GwNUd877kXiSybdED6IUyM3Umihe9glPi9Bu+F?= =?utf-8?q?AT3OUJUdQDJopJQmxhOV+HIRmf2lck3HPRIxFLMFsceadMcsnntJO2FFd9SSKEsDV?= =?utf-8?q?yAtxetEq5ixUxm+tHpeXVsBZxJUVXAav1AK9JAE8QcCIiELXAUL7O4tukkvZ8xOBo?= =?utf-8?q?4bZSqIVQq2jYWC8j2riNvyFNp4+Fe03n/vWS6/p0w+h5r6Zm3rlxCZPW0LE8KJwD5?= =?utf-8?q?n9NxXXhgq8odUqWz6gmGMEkYk/W5lkhOkReXORB5+mcGuSlAU/yTTbcUX5ObB2jrG?= =?utf-8?q?n6wmiW/WE8ObjPkRtHLlVggvozqScWGT/pXLdu0HL2Q9WOClEf26hV3jgaDN74F0a?= =?utf-8?q?Evl8KmaASkP7IOCO3/XIHG0Y5PvVkU+DanLgdWZAz9WQEc6r/TRr2SW2oiy6o4xlc?= =?utf-8?q?zwGPhWM+8QMpM0tIpnWU5oQfp6ENwvGIDH0MwW3ZZuZQdmLn9eYZ0V5jUbt4vvGYQ?= =?utf-8?q?khPsGFEUHD7buNXo9+Fd4jM3PpuLu9R6cH9uMR0faTNwDbSncBgOSlWmr3ALPQxJB?= =?utf-8?q?k182qjhsaSRoVNUpB4+JSDX2pFvOCZXCZzXysQpkpruyP/UCjPqZdxJ4c18ouJolZ?= =?utf-8?q?Iza05yCi7aQVC/WjwqCXHpg6Cm3wZwYl3XEUvxw5+H8jvgPAhyNXwY67tgaoNpSGf?= =?utf-8?q?67AHGREGH/E?= X-Forefront-Antispam-Report: CIP:50.222.100.11;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:uww-mrp-01.datadirectnet.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: oHWc5z7yEkWIj9eCYOPsdlKJlSKRT5Sv8do5abmaFA+9I2cwAR3+V5YUUQ0LqKae59K0f2wgvFK7tb9CgLZqEvbIUoTihg2l67L5xbakYTBskCV2gf5BBvynzUwzXIekaZSV6Z1r4Y8dp0D9hpN+tEdmVGi8iHxBCOEGdVPRqsQOgFABn3wHyn28M4WxgdwHNSNPMpof4UPnuHPZcNavyGfNpnp+smMfra5DGp4ntwn2hvZyguWE9A36fl2QGZzFvR/nOwLwGe016bRiAf8PTJDjVKsUf/iS165fokqOcMSe0ELwtVjhhkSPofLpBLh/IL1DQcXJWespqEtZTYLjfhyfFxTGfjTFY0sWxjzVxNOvavUs0rls0zKuNNkHKA5iCmVHHDPHwDeAzrUN+G/CHBIpG1IBwQG2uXRmC0VdKexJsAWdEDrTXMFt/ZzjuuxCM/WGxCMf0saCalwqoQYtxf7J8qtQ4vfTjBp1O22g+9SVNlsjZMyZFezieBgGbprwvzpk9AXWp589St4dWwlPxWSbZsEmG4Ylu2tA2pSO+567G+i0P5Uao3cX42W/ppZ93qz1AO8SdYjgNBIDl+SeUnpb2vf/AAY9C8yNlhRjhqnsaNU7AJ73m/57Me2kwN/tOS1ctzJ1MaeroFOn6YHSrQ== X-OriginatorOrg: ddn.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2024 14:56:45.3859 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d18e5cef-1589-4a06-a786-08dd1861b341 X-MS-Exchange-CrossTenant-Id: 753b6e26-6fd3-43e6-8248-3f1735d59bb4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=753b6e26-6fd3-43e6-8248-3f1735d59bb4;Ip=[50.222.100.11];Helo=[uww-mrp-01.datadirectnet.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000A6734.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR19MB6240 X-BESS-ID: 1733756213-105335-13467-4253-1 X-BESS-VER: 2019.1_20241126.2220 X-BESS-Apparent-Source-IP: 104.47.58.49 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmbmFuZAVgZQ0NAo2dDA0NTUJN UyzSA5ydTE3NQwMcnSICXJ0CTFKNlEqTYWAKK1z+hBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260997 [from cloudscan12-98.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS124931 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 This change sets up FUSE operations to always have headers in args.in_args[0], even for opcodes without an actual header. This step prepares for a clean separation of payload from headers, initially it is used by fuse-over-io-uring. For opcodes without a header, we use a zero-sized struct as a placeholder. This approach: - Keeps things consistent across all FUSE operations - Will help with payload alignment later - Avoids future issues when header sizes change Op codes that already have an op code specific header do not need modification. Op codes that have neither payload nor op code headers are not modified either (FUSE_READLINK and FUSE_DESTROY). FUSE_BATCH_FORGET already has the header in the right place, but is not using fuse_copy_args - as -over-uring is currently not handling forgets it does not matter for now, but header separation will later need special attention for that op code. Signed-off-by: Bernd Schubert Reviewed-by: Joanne Koong --- fs/fuse/dax.c | 11 ++++++----- fs/fuse/dev.c | 9 +++++---- fs/fuse/dir.c | 32 ++++++++++++++++++-------------- fs/fuse/fuse_i.h | 13 +++++++++++++ fs/fuse/xattr.c | 7 ++++--- 5 files changed, 46 insertions(+), 26 deletions(-) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 9abbc2f2894f905099b48862d776083e6075fbba..0b6ee6dd1fd6569a12f1a44c24ca178163b0da81 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -240,11 +240,12 @@ static int fuse_send_removemapping(struct inode *inode, args.opcode = FUSE_REMOVEMAPPING; args.nodeid = fi->nodeid; - args.in_numargs = 2; - args.in_args[0].size = sizeof(*inargp); - args.in_args[0].value = inargp; - args.in_args[1].size = inargp->count * sizeof(*remove_one); - args.in_args[1].value = remove_one; + args.in_numargs = 3; + fuse_set_zero_arg0(&args); + args.in_args[1].size = sizeof(*inargp); + args.in_args[1].value = inargp; + args.in_args[2].size = inargp->count * sizeof(*remove_one); + args.in_args[2].value = remove_one; return fuse_simple_request(fm, &args); } diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 4f8825de9e05b9ffd291ac5bff747a10a70df0b4..623c5a067c1841e8210b5b4e063e7b6690f1825a 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1746,7 +1746,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, args = &ap->args; args->nodeid = outarg->nodeid; args->opcode = FUSE_NOTIFY_REPLY; - args->in_numargs = 2; + args->in_numargs = 3; args->in_pages = true; args->end = fuse_retrieve_end; @@ -1774,9 +1774,10 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode, } ra->inarg.offset = outarg->offset; ra->inarg.size = total_len; - args->in_args[0].size = sizeof(ra->inarg); - args->in_args[0].value = &ra->inarg; - args->in_args[1].size = total_len; + fuse_set_zero_arg0(args); + args->in_args[1].size = sizeof(ra->inarg); + args->in_args[1].value = &ra->inarg; + args->in_args[2].size = total_len; err = fuse_simple_notify_reply(fm, args, outarg->notify_unique); if (err) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 494ac372ace07ab4ea06c13a404ecc1d2ccb4f23..1c6126069ee7fcce522fbb7bcec21c9392982413 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -175,9 +175,10 @@ static void fuse_lookup_init(struct fuse_conn *fc, struct fuse_args *args, memset(outarg, 0, sizeof(struct fuse_entry_out)); args->opcode = FUSE_LOOKUP; args->nodeid = nodeid; - args->in_numargs = 1; - args->in_args[0].size = name->len + 1; - args->in_args[0].value = name->name; + args->in_numargs = 2; + fuse_set_zero_arg0(args); + args->in_args[1].size = name->len + 1; + args->in_args[1].value = name->name; args->out_numargs = 1; args->out_args[0].size = sizeof(struct fuse_entry_out); args->out_args[0].value = outarg; @@ -928,11 +929,12 @@ static int fuse_symlink(struct mnt_idmap *idmap, struct inode *dir, FUSE_ARGS(args); args.opcode = FUSE_SYMLINK; - args.in_numargs = 2; - args.in_args[0].size = entry->d_name.len + 1; - args.in_args[0].value = entry->d_name.name; - args.in_args[1].size = len; - args.in_args[1].value = link; + args.in_numargs = 3; + fuse_set_zero_arg0(&args); + args.in_args[1].size = entry->d_name.len + 1; + args.in_args[1].value = entry->d_name.name; + args.in_args[2].size = len; + args.in_args[2].value = link; return create_new_entry(idmap, fm, &args, dir, entry, S_IFLNK); } @@ -992,9 +994,10 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry) args.opcode = FUSE_UNLINK; args.nodeid = get_node_id(dir); - args.in_numargs = 1; - args.in_args[0].size = entry->d_name.len + 1; - args.in_args[0].value = entry->d_name.name; + args.in_numargs = 2; + fuse_set_zero_arg0(&args); + args.in_args[1].size = entry->d_name.len + 1; + args.in_args[1].value = entry->d_name.name; err = fuse_simple_request(fm, &args); if (!err) { fuse_dir_changed(dir); @@ -1015,9 +1018,10 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry) args.opcode = FUSE_RMDIR; args.nodeid = get_node_id(dir); - args.in_numargs = 1; - args.in_args[0].size = entry->d_name.len + 1; - args.in_args[0].value = entry->d_name.name; + args.in_numargs = 2; + fuse_set_zero_arg0(&args); + args.in_args[1].size = entry->d_name.len + 1; + args.in_args[1].value = entry->d_name.name; err = fuse_simple_request(fm, &args); if (!err) { fuse_dir_changed(dir); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 74744c6f286003251564d1235f4d2ca8654d661b..babddd05303796d689a64f0f5a890066b43170ac 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -947,6 +947,19 @@ struct fuse_mount { struct rcu_head rcu; }; +/* + * Empty header for FUSE opcodes without specific header needs. + * Used as a placeholder in args->in_args[0] for consistency + * across all FUSE operations, simplifying request handling. + */ +struct fuse_zero_header {}; + +static inline void fuse_set_zero_arg0(struct fuse_args *args) +{ + args->in_args[0].size = sizeof(struct fuse_zero_header); + args->in_args[0].value = NULL; +} + static inline struct fuse_mount *get_fuse_mount_super(struct super_block *sb) { return sb->s_fs_info; diff --git a/fs/fuse/xattr.c b/fs/fuse/xattr.c index 9f568d345c51236ddd421b162820a4ea9b0734f4..93dfb06b6cea045d6df90c61c900680968bda39f 100644 --- a/fs/fuse/xattr.c +++ b/fs/fuse/xattr.c @@ -164,9 +164,10 @@ int fuse_removexattr(struct inode *inode, const char *name) args.opcode = FUSE_REMOVEXATTR; args.nodeid = get_node_id(inode); - args.in_numargs = 1; - args.in_args[0].size = strlen(name) + 1; - args.in_args[0].value = name; + args.in_numargs = 2; + fuse_set_zero_arg0(&args); + args.in_args[1].size = strlen(name) + 1; + args.in_args[1].value = name; err = fuse_simple_request(fm, &args); if (err == -ENOSYS) { fm->fc->no_removexattr = 1;