From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33448481244 for ; Tue, 21 Jul 2026 10:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784630164; cv=none; b=d1N7Js7kvNniEpk2IsEj+ZkzfbebyPX43x0Inq7gjTzPSY5x9cajvwD/a0tlbYAkaVbSELsiU+cS1g/SDUwt4oAM+WtOI6Qf599o6yGXPGsKaXDAGmTZ5I2G2IWxxKXOVj8+WwAT3UjThg0yHRKYe+eMWYKf8hR1Acp0LiPO/10= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784630164; c=relaxed/simple; bh=AHoE8B0vKzWqpdJAHDaftEMLzrqBA9eXmvJ0WGKiDF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J6rxBy9ffTRNsBvmWXdXyv1Jabbo7MbWbwHMJZv1Bb/2MioExrTSNs/hUI/To6FVjy391iJD8stptABevQo6o0f7dqzP3hmnxSbJUEQvYp4qBxT8UEvDJQkwzj5tBloJUIGjroS+U12P7XaGzYVTU3PlB+xBq/apfbJb7WYQtYM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=rhxK76fw; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rhxK76fw" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-ca97d139d8dso4656081a12.2 for ; Tue, 21 Jul 2026 03:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784630162; x=1785234962; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HrK5Y+cUu3sn93vpsDCo0Tjc6K/8b9DvciXsUp54rDw=; b=rhxK76fwYSV+kxNzS+Y8rrTNMtBI7+fVKKGjWlwv+4mdFoOAMJg35idY/lqUoM5e6s XdiPzmCV73jqsWZc0WEpZxmEgneSpdgk6WdG5i799MEkNUOiPV49h3XYEnIcGbGWGSnD 3b9vlxPoqghQWnNXpXfcdPoXpKDpgIwH4IOF5RW9NUQOkYcQyhSL1S91Mmlcdqf7zWdr Rx0H054Ij1pEWrh5jcRBhHK4W0nRhnUa8AOmt4KF8lQf/mgBjzESp2LISBZP6fRTw2z+ 9wALTJd1cUdzSetiH6sL8QktzpVmm9cWZJnOoBRmPZBF6t6CsFy0/H6nBCqKmEAHb1MS RXHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784630162; x=1785234962; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=HrK5Y+cUu3sn93vpsDCo0Tjc6K/8b9DvciXsUp54rDw=; b=YzLUoqUgVaL/pNPjHmuIvFSnm2GuddgtBYsqbujZJxPp0MSs3tpstz+jp6e9/EvEpM 5opubcjIIxIfgaF2haC/al9j8IC1/M/ImGqu6rM/WoVWsULbU6HARkouPsI2ZjGFUqUA M0PZ7CkTHkMjpIh/frtVIQKnN2h+GHkC79OWCDgpOd+krF9VRsdeSfsldty6e+FayzI3 yqOg/4qrvUjtzLYdFyJ2/lPPqMOuIUFM92wSypWN8Z7TDp4FkvPbChefLvSZZPq4yC58 9v33yLrNeBFMX0EykmPCWlOzoUWhxG0itfEaXWYzqiP2OgIGnslDQ7hrJjHruMFdvEFe NSig== X-Forwarded-Encrypted: i=1; AHgh+Rq8Rs0Mv8u9urUJdzjiDfxcIvaPVHhfMfg0B8PXQDtVoAn1cpXzq4Wtw/2zR4wR/LeDVySPu3vAXrv6kpM=@vger.kernel.org X-Gm-Message-State: AOJu0Yw3H80Pm4jR5+v3HHIwba1cKVPsu3lIrloBKC0Z/R8BG9CXmy7N Cp8vF8vntQNEZ6wpVYEDCOH7LlNOkbz7L71PrEWXRA4J0wsVBJfugEIc X-Gm-Gg: AfdE7claxpxUUnWi6aO9aHpbXJrdy10Qez7K4JHJRfT62apMk9EkmMIfQt2e2WKxta7 m/U6xMqFh4g9CVfAn9sHo6lgAuuxhbuvNZ06E6/+d80Hd022X4WRviRSXcIURA/3GDNOLFKJeiU yLDfPF1oTpagjvfcaZLX8eVQ7h14pM+SGy+4coYpujNPZn3+HXG0JyxddMYvjVZ+9wUVWTo2ylF dfUppYL//maWIBYa3RpVGLmFpBQK/uyTM7H9n96hYuL3vSmR3WPV59kde65VupJi/pYIs1XslfV 9XoL6FHml7MezFl9hRWpHg1u6/G58uJ/c1S9V5/Hzh0IZfwahpJzE7SQDLci/TZVm5nacynUrxV 2B1lejZJyvs+UmX4MEgw1IDqDRZ7BJHOMypUiK8gLoQkX7NuWdE4TUZV3k4WaKsSR4gMS+NIZXn 8Q5S5CUdIJ9mjmAg+HXIGzvWpReTpgPbN4Bc62sXAkszEqmjSYuO50+Z8hY2rsDROI13BPyxTgh YotiKtHFPYC8Tyt3NB3c5jvUB0cePKwW/qRCLHE2s6E1/h7UD7ukk8vdIcPUn/xTqrH50Wedeoq Ndvcz0zcnbbptAg= X-Received: by 2002:a05:6a21:e097:b0:3c3:7762:5d51 with SMTP id adf61e73a8af0-3c3ad9ecc4fmr19421868637.62.1784630162578; Tue, 21 Jul 2026 03:36:02 -0700 (PDT) Received: from cs-1047136853211-default.asia-southeast1-a.c.z168d0f9edf9bc766-tp.internal (114.107.87.34.bc.googleusercontent.com. [34.87.107.114]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3142a20c158sm49922929eec.29.2026.07.21.03.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2026 03:36:02 -0700 (PDT) From: Aditya Prakash Srivastava To: Jens Axboe , Christian Brauner , Alexander Viro Cc: Jan Kara , io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Aditya Prakash Srivastava Subject: [PATCH v3 2/2] io_uring: add fremovexattr and flistxattr support Date: Tue, 21 Jul 2026 10:35:14 +0000 Message-ID: <20260721103514.2716-3-aditya.ansh182@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260721103514.2716-1-aditya.ansh182@gmail.com> References: <20260721103514.2716-1-aditya.ansh182@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add support for IORING_OP_FREMOVEXATTR and IORING_OP_FLISTXATTR. This enables xattr listing and removal operations to be executed in an asynchronous fashion. Signed-off-by: Aditya Prakash Srivastava --- include/uapi/linux/io_uring.h | 2 + io_uring/opdef.c | 18 +++++++ io_uring/xattr.c | 74 +++++++++++++++++++++++++++++ io_uring/xattr.h | 6 +++ tools/include/uapi/linux/io_uring.h | 13 +++++ 5 files changed, 113 insertions(+) diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 909fb7aea638..805f1e31f492 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -318,6 +318,8 @@ enum io_uring_op { IORING_OP_PIPE, IORING_OP_NOP128, IORING_OP_URING_CMD128, + IORING_OP_FREMOVEXATTR, + IORING_OP_FLISTXATTR, /* this goes last, obviously */ IORING_OP_LAST, diff --git a/io_uring/opdef.c b/io_uring/opdef.c index 4e58eb1344ea..25d9229d8fc0 100644 --- a/io_uring/opdef.c +++ b/io_uring/opdef.c @@ -591,6 +591,16 @@ const struct io_issue_def io_issue_defs[] = { .prep = io_uring_cmd_prep, .issue = io_uring_cmd, }, + [IORING_OP_FREMOVEXATTR] = { + .needs_file = 1, + .prep = io_fremovexattr_prep, + .issue = io_fremovexattr, + }, + [IORING_OP_FLISTXATTR] = { + .needs_file = 1, + .prep = io_flistxattr_prep, + .issue = io_flistxattr, + }, }; const struct io_cold_def io_cold_defs[] = { @@ -849,6 +859,14 @@ const struct io_cold_def io_cold_defs[] = { .sqe_copy = io_uring_cmd_sqe_copy, .cleanup = io_uring_cmd_cleanup, }, + [IORING_OP_FREMOVEXATTR] = { + .name = "FREMOVEXATTR", + .cleanup = io_xattr_cleanup, + }, + [IORING_OP_FLISTXATTR] = { + .name = "FLISTXATTR", + .cleanup = io_xattr_cleanup, + }, }; const char *io_uring_get_opcode(u8 opcode) diff --git a/io_uring/xattr.c b/io_uring/xattr.c index 5303df3f247f..9b410f91ef43 100644 --- a/io_uring/xattr.c +++ b/io_uring/xattr.c @@ -195,3 +195,77 @@ int io_setxattr(struct io_kiocb *req, unsigned int issue_flags) io_xattr_finish(req, ret); return IOU_COMPLETE; } + +int io_fremovexattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) +{ + struct io_xattr *ix = io_kiocb_to_cmd(req, struct io_xattr); + const char __user *name; + int ret; + + INIT_DELAYED_FILENAME(&ix->filename); + name = u64_to_user_ptr(READ_ONCE(sqe->addr)); + + if (READ_ONCE(sqe->addr2) || READ_ONCE(sqe->len) || READ_ONCE(sqe->xattr_flags)) + return -EINVAL; + + ix->ctx.kname = kmalloc_obj(*ix->ctx.kname); + if (!ix->ctx.kname) + return -ENOMEM; + + ret = import_xattr_name(ix->ctx.kname, name); + if (ret) { + kfree(ix->ctx.kname); + return ret; + } + + req->flags |= REQ_F_NEED_CLEANUP; + req->flags |= REQ_F_FORCE_ASYNC; + return 0; +} + +int io_fremovexattr(struct io_kiocb *req, unsigned int issue_flags) +{ + struct io_xattr *ix = io_kiocb_to_cmd(req, struct io_xattr); + int ret; + + WARN_ON_ONCE(issue_flags & IO_URING_F_NONBLOCK); + + ret = file_removexattr(req->file, ix->ctx.kname); + io_xattr_finish(req, ret); + return IOU_COMPLETE; +} + +int io_flistxattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) +{ + struct io_xattr *ix = io_kiocb_to_cmd(req, struct io_xattr); + + INIT_DELAYED_FILENAME(&ix->filename); + ix->ctx.kname = NULL; + ix->ctx.kvalue = NULL; + + if (READ_ONCE(sqe->addr)) + return -EINVAL; + + ix->ctx.value = u64_to_user_ptr(READ_ONCE(sqe->addr2)); + ix->ctx.size = READ_ONCE(sqe->len); + ix->ctx.flags = READ_ONCE(sqe->xattr_flags); + + if (ix->ctx.flags) + return -EINVAL; + + req->flags |= REQ_F_NEED_CLEANUP; + req->flags |= REQ_F_FORCE_ASYNC; + return 0; +} + +int io_flistxattr(struct io_kiocb *req, unsigned int issue_flags) +{ + struct io_xattr *ix = io_kiocb_to_cmd(req, struct io_xattr); + int ret; + + WARN_ON_ONCE(issue_flags & IO_URING_F_NONBLOCK); + + ret = file_listxattr(req->file, ix->ctx.value, ix->ctx.size); + io_xattr_finish(req, ret); + return IOU_COMPLETE; +} diff --git a/io_uring/xattr.h b/io_uring/xattr.h index 9b459d2ae90c..d2487b49a5d2 100644 --- a/io_uring/xattr.h +++ b/io_uring/xattr.h @@ -13,3 +13,9 @@ int io_fgetxattr(struct io_kiocb *req, unsigned int issue_flags); int io_getxattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); int io_getxattr(struct io_kiocb *req, unsigned int issue_flags); + +int io_fremovexattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); +int io_fremovexattr(struct io_kiocb *req, unsigned int issue_flags); + +int io_flistxattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); +int io_flistxattr(struct io_kiocb *req, unsigned int issue_flags); diff --git a/tools/include/uapi/linux/io_uring.h b/tools/include/uapi/linux/io_uring.h index f1c16f817742..79bf7c22009d 100644 --- a/tools/include/uapi/linux/io_uring.h +++ b/tools/include/uapi/linux/io_uring.h @@ -253,6 +253,19 @@ enum io_uring_op { IORING_OP_FUTEX_WAIT, IORING_OP_FUTEX_WAKE, IORING_OP_FUTEX_WAITV, + IORING_OP_FIXED_FD_INSTALL, + IORING_OP_FTRUNCATE, + IORING_OP_BIND, + IORING_OP_LISTEN, + IORING_OP_RECV_ZC, + IORING_OP_EPOLL_WAIT, + IORING_OP_READV_FIXED, + IORING_OP_WRITEV_FIXED, + IORING_OP_PIPE, + IORING_OP_NOP128, + IORING_OP_URING_CMD128, + IORING_OP_FREMOVEXATTR, + IORING_OP_FLISTXATTR, /* this goes last, obviously */ IORING_OP_LAST, -- 2.47.3