From nobody Thu Apr 30 08:28:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0D74C4332F for ; Tue, 31 May 2022 18:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347103AbiEaSlv (ORCPT ); Tue, 31 May 2022 14:41:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347083AbiEaSlk (ORCPT ); Tue, 31 May 2022 14:41:40 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5937219A for ; Tue, 31 May 2022 11:41:38 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id s24so12518821wrb.10 for ; Tue, 31 May 2022 11:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S9z0cgWSdzuNDYsClRCoaHxcUfzXO4qdo7JoYy7eKoQ=; b=SyurLTOPAgt8jtpuqmCy2s27VTT6DzLTYWIb0oBionaq6/S2ik6d80OCcJCnAhaLqi iG1XUUg2J7GGKWQoWAV2vaS4qK6ipDubfqfnZJ33pf51JlrR3vBId3JMY6Ri41vl66// fKNPZYH+92lozH4IlkJVJe0HNPjqIGDIq2bhV4+7v/2m3TsBurCfRRUbO5zPb8x013hK t0NfNh3KaD2ggi2zsTcY7TuznIzEMnBovrA75CyKxE2OIqYGAYXGgHbls3XSCT8LWEii uf9qiTVuT5tWD48SgXQVJUQ3GNGZNZtSpkGXCF2slG8N0AhxK1B4kIx7iDsO4W6q8bSS gxgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S9z0cgWSdzuNDYsClRCoaHxcUfzXO4qdo7JoYy7eKoQ=; b=5Ja38/5W1gSj+5P3aKQRTz7FSZJZuHZMPytvU+xCxblnXa8HO8WTRPzu3/tgMwdT7s nptL7hu6QMBjvC1dDYk9u6j9m4Wdp052xmanKycRKKrwrA0ivFGP4UBQujLhjAuW15ID qU9XuZmd+qwMwh0WTIS8zO1hgHSt4InMm+XZU+enmBiwr7i0z50AZEGs7KhPaxPVMmRP a/1arqLm9Wk1RQluM+acbxmhcDcD6YZN5mM8iHkU+9VHBkmeileN4RH+9kOzhBW48lla fn4Mk0hoU8ipWGbOuHS+625MgX/tE7PtZ1EexreabNNnENNxw5Rhng0UthvrgQFWS9qO zTYA== X-Gm-Message-State: AOAM533zPvszvQ7QCR7cRTLQX0WkMtgtNbDCuRm7stJp9b38Ua3RiN8f svTa6U/LU3BWNqOWEWryKqFvwQ== X-Google-Smtp-Source: ABdhPJxwFiuca8ofjiHGT50feRtrXarHzbJ8vQ4TAwDQvdZJ65iPV3gNXFQJ6kxo0/4VYqc1Nr+FTA== X-Received: by 2002:adf:fa0d:0:b0:210:1225:fc77 with SMTP id m13-20020adffa0d000000b002101225fc77mr20969006wrr.528.1654022496954; Tue, 31 May 2022 11:41:36 -0700 (PDT) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6a:b497:0:359:2800:e38d:e04f]) by smtp.gmail.com with ESMTPSA id o16-20020a05600c059000b00397342bcfb7sm2831877wmd.46.2022.05.31.11.41.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 11:41:36 -0700 (PDT) From: Usama Arif To: io-uring@vger.kernel.org, axboe@kernel.dk, linux-kernel@vger.kernel.org Cc: fam.zheng@bytedance.com, Usama Arif Subject: [PATCH 1/5] io_uring: add rename opcode for current working directory Date: Tue, 31 May 2022 19:41:21 +0100 Message-Id: <20220531184125.2665210-2-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531184125.2665210-1-usama.arif@bytedance.com> References: <20220531184125.2665210-1-usama.arif@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This provides consistency between io_uring and the respective I/O syscall and avoids having the user of liburing specify the cwd in sqe for IORING_OP_RENAMEAT. Signed-off-by: Usama Arif --- fs/io_uring.c | 25 ++++++++++++++++++------- include/uapi/linux/io_uring.h | 1 + 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 9f1c682d7caf..8bf56523ff7f 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1306,6 +1306,7 @@ static const struct io_op_def io_op_defs[] =3D { [IORING_OP_SHUTDOWN] =3D { .needs_file =3D 1, }, + [IORING_OP_RENAME] =3D {}, [IORING_OP_RENAMEAT] =3D {}, [IORING_OP_UNLINKAT] =3D {}, [IORING_OP_MKDIRAT] =3D {}, @@ -1449,6 +1450,8 @@ const char *io_uring_get_opcode(u8 opcode) return "TEE"; case IORING_OP_SHUTDOWN: return "SHUTDOWN"; + case IORING_OP_RENAME: + return "RENAME"; case IORING_OP_RENAMEAT: return "RENAMEAT"; case IORING_OP_UNLINKAT: @@ -4553,8 +4556,8 @@ static int io_write(struct io_kiocb *req, unsigned in= t issue_flags) return ret; } =20 -static int io_renameat_prep(struct io_kiocb *req, - const struct io_uring_sqe *sqe) +static int io_rename_prep(struct io_kiocb *req, + const struct io_uring_sqe *sqe, bool is_cwd) { struct io_rename *ren =3D &req->rename; const char __user *oldf, *newf; @@ -4564,10 +4567,14 @@ static int io_renameat_prep(struct io_kiocb *req, if (unlikely(req->flags & REQ_F_FIXED_FILE)) return -EBADF; =20 - ren->old_dfd =3D READ_ONCE(sqe->fd); + if (is_cwd) { + ren->old_dfd =3D ren->new_dfd =3D AT_FDCWD; + } else { + ren->old_dfd =3D READ_ONCE(sqe->fd); + ren->new_dfd =3D READ_ONCE(sqe->len); + } oldf =3D u64_to_user_ptr(READ_ONCE(sqe->addr)); newf =3D u64_to_user_ptr(READ_ONCE(sqe->addr2)); - ren->new_dfd =3D READ_ONCE(sqe->len); ren->flags =3D READ_ONCE(sqe->rename_flags); =20 ren->oldpath =3D getname(oldf); @@ -4584,7 +4591,7 @@ static int io_renameat_prep(struct io_kiocb *req, return 0; } =20 -static int io_renameat(struct io_kiocb *req, unsigned int issue_flags) +static int io_rename(struct io_kiocb *req, unsigned int issue_flags) { struct io_rename *ren =3D &req->rename; int ret; @@ -8076,8 +8083,10 @@ static int io_req_prep(struct io_kiocb *req, const s= truct io_uring_sqe *sqe) return io_tee_prep(req, sqe); case IORING_OP_SHUTDOWN: return io_shutdown_prep(req, sqe); + case IORING_OP_RENAME: + return io_rename_prep(req, sqe, 1); case IORING_OP_RENAMEAT: - return io_renameat_prep(req, sqe); + return io_rename_prep(req, sqe, 0); case IORING_OP_UNLINKAT: return io_unlinkat_prep(req, sqe); case IORING_OP_MKDIRAT: @@ -8229,6 +8238,7 @@ static void io_clean_op(struct io_kiocb *req) if (req->open.filename) putname(req->open.filename); break; + case IORING_OP_RENAME: case IORING_OP_RENAMEAT: putname(req->rename.oldpath); putname(req->rename.newpath); @@ -8395,8 +8405,9 @@ static int io_issue_sqe(struct io_kiocb *req, unsigne= d int issue_flags) case IORING_OP_SHUTDOWN: ret =3D io_shutdown(req, issue_flags); break; + case IORING_OP_RENAME: case IORING_OP_RENAMEAT: - ret =3D io_renameat(req, issue_flags); + ret =3D io_rename(req, issue_flags); break; case IORING_OP_UNLINKAT: ret =3D io_unlinkat(req, issue_flags); diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 53e7dae92e42..73f4e1c4133d 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -189,6 +189,7 @@ enum io_uring_op { IORING_OP_GETXATTR, IORING_OP_SOCKET, IORING_OP_URING_CMD, + IORING_OP_RENAME, =20 /* this goes last, obviously */ IORING_OP_LAST, --=20 2.25.1 From nobody Thu Apr 30 08:28:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62588C433F5 for ; Tue, 31 May 2022 18:41:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347111AbiEaSly (ORCPT ); Tue, 31 May 2022 14:41:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347085AbiEaSll (ORCPT ); Tue, 31 May 2022 14:41:41 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54AC5B4E for ; Tue, 31 May 2022 11:41:39 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id u3so19837735wrg.3 for ; Tue, 31 May 2022 11:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GyYrzMYdcSF2goCR70E9AdY9237cGTWSWoDyblu5Hto=; b=2rvIVYNwD6PevpWnhzXXXCr8CZ+NoyLRKxabrGzLYHeSnKAdpxQ8h1HvJ6g/VglqWP cnQZ+yWOhq7G+hjEoPArYgCiJfz6H8vdJ+jbZMRLrIqWEWxf3yxQpinkMffzRWFkhMMT HhnVvPDrENgmNcJaGou11Tf7dEiFJF5Qmh4xuXbSbfFvurQzY+gS0T2wT2Om5TQP/yLW K5pzW5C/pW/8qjRdAAlsVX82ebzqioK8G96CEIG8xCjX8eUmmY9DDxuv1yeeuBajNB2x DHYKu5AqDExgpu36tsevh6g3o1Y5g4zDbBZE7f4MIYkIr6GfkyKz5pVYHpMLeIeiC4xn EVZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GyYrzMYdcSF2goCR70E9AdY9237cGTWSWoDyblu5Hto=; b=RC7r9AKmlXNMcd/BK3qE9ALpgGAJzbCvHMPwNw4tsj7T972Xf+s/WXDOpi9VceXkBk wpxTJcdbe3NFkVhXl75JoN0A1kysYEq3rkk1RaObvOFrLjJBwOSPPyH4UkpuYH3LuI2q dEkCt76tRSw7JiDQejAOPOBKr6tk0J/xBplSTiBvvNq1bK/rYsonevOB7Z7VyZoL/+Ph e8NIj1Vorw25Uce8UUzIOP0CQ7QafJK6u2r5fBFQzb7w4d8NrRWAxQbv7aEEYv8jP+5J xhctNp+ZaYyNYec8InPlFI5PzizR1/kEl8NalRwT5715Vq7XDPuvROdQIPOjB7oMECM4 krXw== X-Gm-Message-State: AOAM533G+qwPMk55j7nEwtBoXVttxSlZn6LKfgWOHg4GZ6O5Y9SeqgEP jIXPptZN0DH1b15qIZomEhhgXw== X-Google-Smtp-Source: ABdhPJx9uvIPQcHnGrm7Y5H8Jcw5DOfOm5cIXrJq76TAyMmoI9XRYWN4SjYmxzRMsMlO+9lrlT6ZHA== X-Received: by 2002:adf:d1a8:0:b0:210:2bc3:c3b4 with SMTP id w8-20020adfd1a8000000b002102bc3c3b4mr13231172wrc.54.1654022497955; Tue, 31 May 2022 11:41:37 -0700 (PDT) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6a:b497:0:359:2800:e38d:e04f]) by smtp.gmail.com with ESMTPSA id o16-20020a05600c059000b00397342bcfb7sm2831877wmd.46.2022.05.31.11.41.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 11:41:37 -0700 (PDT) From: Usama Arif To: io-uring@vger.kernel.org, axboe@kernel.dk, linux-kernel@vger.kernel.org Cc: fam.zheng@bytedance.com, Usama Arif Subject: [PATCH 2/5] io_uring: add unlink opcode for current working directory Date: Tue, 31 May 2022 19:41:22 +0100 Message-Id: <20220531184125.2665210-3-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531184125.2665210-1-usama.arif@bytedance.com> References: <20220531184125.2665210-1-usama.arif@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This provides consistency between io_uring and the respective I/O syscall and avoids having the user of liburing specify the cwd in sqe for IORING_OP_UNLINKAT. Signed-off-by: Usama Arif --- fs/io_uring.c | 22 ++++++++++++++++------ include/uapi/linux/io_uring.h | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 8bf56523ff7f..d38c5f54f6a4 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1308,6 +1308,7 @@ static const struct io_op_def io_op_defs[] =3D { }, [IORING_OP_RENAME] =3D {}, [IORING_OP_RENAMEAT] =3D {}, + [IORING_OP_UNLINK] =3D {}, [IORING_OP_UNLINKAT] =3D {}, [IORING_OP_MKDIRAT] =3D {}, [IORING_OP_SYMLINKAT] =3D {}, @@ -1454,6 +1455,8 @@ const char *io_uring_get_opcode(u8 opcode) return "RENAME"; case IORING_OP_RENAMEAT: return "RENAMEAT"; + case IORING_OP_UNLINK: + return "UNLINK"; case IORING_OP_UNLINKAT: return "UNLINKAT"; case IORING_OP_MKDIRAT: @@ -4847,8 +4850,8 @@ static int io_setxattr(struct io_kiocb *req, unsigned= int issue_flags) return 0; } =20 -static int io_unlinkat_prep(struct io_kiocb *req, - const struct io_uring_sqe *sqe) +static int io_unlink_prep(struct io_kiocb *req, + const struct io_uring_sqe *sqe, bool is_cwd) { struct io_unlink *un =3D &req->unlink; const char __user *fname; @@ -4858,7 +4861,10 @@ static int io_unlinkat_prep(struct io_kiocb *req, if (unlikely(req->flags & REQ_F_FIXED_FILE)) return -EBADF; =20 - un->dfd =3D READ_ONCE(sqe->fd); + if (is_cwd) + un->dfd =3D AT_FDCWD; + else + un->dfd =3D READ_ONCE(sqe->fd); =20 un->flags =3D READ_ONCE(sqe->unlink_flags); if (un->flags & ~AT_REMOVEDIR) @@ -4873,7 +4879,7 @@ static int io_unlinkat_prep(struct io_kiocb *req, return 0; } =20 -static int io_unlinkat(struct io_kiocb *req, unsigned int issue_flags) +static int io_unlink(struct io_kiocb *req, unsigned int issue_flags) { struct io_unlink *un =3D &req->unlink; int ret; @@ -8087,8 +8093,10 @@ static int io_req_prep(struct io_kiocb *req, const s= truct io_uring_sqe *sqe) return io_rename_prep(req, sqe, 1); case IORING_OP_RENAMEAT: return io_rename_prep(req, sqe, 0); + case IORING_OP_UNLINK: + return io_unlink_prep(req, sqe, 1); case IORING_OP_UNLINKAT: - return io_unlinkat_prep(req, sqe); + return io_unlink_prep(req, sqe, 0); case IORING_OP_MKDIRAT: return io_mkdirat_prep(req, sqe); case IORING_OP_SYMLINKAT: @@ -8243,6 +8251,7 @@ static void io_clean_op(struct io_kiocb *req) putname(req->rename.oldpath); putname(req->rename.newpath); break; + case IORING_OP_UNLINK: case IORING_OP_UNLINKAT: putname(req->unlink.filename); break; @@ -8409,8 +8418,9 @@ static int io_issue_sqe(struct io_kiocb *req, unsigne= d int issue_flags) case IORING_OP_RENAMEAT: ret =3D io_rename(req, issue_flags); break; + case IORING_OP_UNLINK: case IORING_OP_UNLINKAT: - ret =3D io_unlinkat(req, issue_flags); + ret =3D io_unlink(req, issue_flags); break; case IORING_OP_MKDIRAT: ret =3D io_mkdirat(req, issue_flags); diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 73f4e1c4133d..7828b7183d01 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -190,6 +190,7 @@ enum io_uring_op { IORING_OP_SOCKET, IORING_OP_URING_CMD, IORING_OP_RENAME, + IORING_OP_UNLINK, =20 /* this goes last, obviously */ IORING_OP_LAST, --=20 2.25.1 From nobody Thu Apr 30 08:28:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5667CC433EF for ; Tue, 31 May 2022 18:42:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347133AbiEaSl7 (ORCPT ); Tue, 31 May 2022 14:41:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347096AbiEaSlq (ORCPT ); Tue, 31 May 2022 14:41:46 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39054D82 for ; Tue, 31 May 2022 11:41:40 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id p5-20020a1c2905000000b003970dd5404dso1701149wmp.0 for ; Tue, 31 May 2022 11:41:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XTP4iDeAMMuWaU0byLugZsxmmGz2FMBqZk2mPA87o8Q=; b=p0YDYKj8oZBxmO/xWmHF5WPpVOyfJA/9pKYiDLKO7RewCeqRaFWDAJV2ZrFdEeHThp p4KkXG+5GqWE7Xc3tp4VkSidmYM71M0yddL14rOXcHDOIYyqej6GFQjgSoB1Xk1xWTkG dkSn3hXbDI4d/vF5qI+RiSaSOKtYrtxLNoNYTl71aCHZVlbDN1L9Fx9G8qyuXgO5wUBm cr/QYqDcVFQi/s7B+bjZEhTws0JlGFgC3JpQ1laGjlL+14RLYMojR744BKAOwsYte/9Y ZYyq0LBDoGNjWAb1ZHeVnXmbrtNQXkLpwtfmYAbKvzSeFfr4AOGgQs/aMsz1c1pB3G80 t3qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XTP4iDeAMMuWaU0byLugZsxmmGz2FMBqZk2mPA87o8Q=; b=GqtYBsjQRAcJikBVNK45BoV7ZKg6VBIl/gqmPY+Cf+SoI/89CyUUAMkmdlApbUFwV8 qV+07qkdSGLysCPlaVubPUsKpmoWjaf32e6WI4guZasfX0+B/VrEt+k4c4+q5yd8hmWa jpo0quRmpaEUjPITb7KvgncUWvZqj2NkNwOrntsy59w3/zJxGBza+zWcUq33C5FIx3Fr VDZb4mYrq1qSHxwtk1OLG01jKb80ZXoqghViWueV+HcoHICCR/GI5k9RgDjFAuvMMLZw IC0RmNwkyNExfoAKKPsppic0nupxFIsPJUi5NeZsULhrCjIi/0Pqc2O63g3WiqO3uv8I /ixw== X-Gm-Message-State: AOAM532EwpCaijz/gOacrPMSorhYpxYZbdaOW8O7gkCLOhGV0/ds1vRH u8Kr5ZyNxAbuPo86ZKhNztcmdjIOP6vqNBIx X-Google-Smtp-Source: ABdhPJzx6d9KhKDRsVYcHz8vULjo9gLdcOVZTLF/sAl1DSfU3ljxs+Atq3KRXfcrkUi6rhU56lnIlA== X-Received: by 2002:a1c:5403:0:b0:397:3437:bbcf with SMTP id i3-20020a1c5403000000b003973437bbcfmr24705133wmb.1.1654022498794; Tue, 31 May 2022 11:41:38 -0700 (PDT) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6a:b497:0:359:2800:e38d:e04f]) by smtp.gmail.com with ESMTPSA id o16-20020a05600c059000b00397342bcfb7sm2831877wmd.46.2022.05.31.11.41.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 11:41:38 -0700 (PDT) From: Usama Arif To: io-uring@vger.kernel.org, axboe@kernel.dk, linux-kernel@vger.kernel.org Cc: fam.zheng@bytedance.com, Usama Arif Subject: [PATCH 3/5] io_uring: add mkdir opcode for current working directory Date: Tue, 31 May 2022 19:41:23 +0100 Message-Id: <20220531184125.2665210-4-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531184125.2665210-1-usama.arif@bytedance.com> References: <20220531184125.2665210-1-usama.arif@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This provides consistency between io_uring and the respective I/O syscall and avoids having the user of liburing specify the cwd in sqe for IORING_OP_MKDIRAT. Signed-off-by: Usama Arif --- fs/io_uring.c | 20 +++++++++++++++----- include/uapi/linux/io_uring.h | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index d38c5f54f6a4..9c9fa0b3938d 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1310,6 +1310,7 @@ static const struct io_op_def io_op_defs[] =3D { [IORING_OP_RENAMEAT] =3D {}, [IORING_OP_UNLINK] =3D {}, [IORING_OP_UNLINKAT] =3D {}, + [IORING_OP_MKDIR] =3D {}, [IORING_OP_MKDIRAT] =3D {}, [IORING_OP_SYMLINKAT] =3D {}, [IORING_OP_LINKAT] =3D {}, @@ -1459,6 +1460,8 @@ const char *io_uring_get_opcode(u8 opcode) return "UNLINK"; case IORING_OP_UNLINKAT: return "UNLINKAT"; + case IORING_OP_MKDIR: + return "MKDIR"; case IORING_OP_MKDIRAT: return "MKDIRAT"; case IORING_OP_SYMLINKAT: @@ -4897,8 +4900,8 @@ static int io_unlink(struct io_kiocb *req, unsigned i= nt issue_flags) return 0; } =20 -static int io_mkdirat_prep(struct io_kiocb *req, - const struct io_uring_sqe *sqe) +static int io_mkdir_prep(struct io_kiocb *req, + const struct io_uring_sqe *sqe, bool is_cwd) { struct io_mkdir *mkd =3D &req->mkdir; const char __user *fname; @@ -4908,7 +4911,10 @@ static int io_mkdirat_prep(struct io_kiocb *req, if (unlikely(req->flags & REQ_F_FIXED_FILE)) return -EBADF; =20 - mkd->dfd =3D READ_ONCE(sqe->fd); + if (is_cwd) + mkd->dfd =3D AT_FDCWD; + else + mkd->dfd =3D READ_ONCE(sqe->fd); mkd->mode =3D READ_ONCE(sqe->len); =20 fname =3D u64_to_user_ptr(READ_ONCE(sqe->addr)); @@ -4920,7 +4926,7 @@ static int io_mkdirat_prep(struct io_kiocb *req, return 0; } =20 -static int io_mkdirat(struct io_kiocb *req, unsigned int issue_flags) +static int io_mkdir(struct io_kiocb *req, unsigned int issue_flags) { struct io_mkdir *mkd =3D &req->mkdir; int ret; @@ -8097,8 +8103,10 @@ static int io_req_prep(struct io_kiocb *req, const s= truct io_uring_sqe *sqe) return io_unlink_prep(req, sqe, 1); case IORING_OP_UNLINKAT: return io_unlink_prep(req, sqe, 0); + case IORING_OP_MKDIR: + return io_mkdir_prep(req, sqe, 1); case IORING_OP_MKDIRAT: - return io_mkdirat_prep(req, sqe); + return io_mkdir_prep(req, sqe, 0); case IORING_OP_SYMLINKAT: return io_symlinkat_prep(req, sqe); case IORING_OP_LINKAT: @@ -8255,6 +8263,7 @@ static void io_clean_op(struct io_kiocb *req) case IORING_OP_UNLINKAT: putname(req->unlink.filename); break; + case IORING_OP_MKDIR: case IORING_OP_MKDIRAT: putname(req->mkdir.filename); break; @@ -8422,6 +8431,7 @@ static int io_issue_sqe(struct io_kiocb *req, unsigne= d int issue_flags) case IORING_OP_UNLINKAT: ret =3D io_unlink(req, issue_flags); break; + case IORING_OP_MKDIR: case IORING_OP_MKDIRAT: ret =3D io_mkdirat(req, issue_flags); break; diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 7828b7183d01..58f2e0611152 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -191,6 +191,7 @@ enum io_uring_op { IORING_OP_URING_CMD, IORING_OP_RENAME, IORING_OP_UNLINK, + IORING_OP_MKDIR, =20 /* this goes last, obviously */ IORING_OP_LAST, --=20 2.25.1 From nobody Thu Apr 30 08:28:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E609C433EF for ; Tue, 31 May 2022 18:42:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347157AbiEaSmC (ORCPT ); Tue, 31 May 2022 14:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347097AbiEaSlq (ORCPT ); Tue, 31 May 2022 14:41:46 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AC9B65F7 for ; Tue, 31 May 2022 11:41:41 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id o29-20020a05600c511d00b00397697f172dso1573907wms.0 for ; Tue, 31 May 2022 11:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rtdKQ4qOY7eJ81qn7DIrL6RA+TOtlT/guME4SLgx8hA=; b=IoPnpQ2UYg24JkCaXCtMCELRX9jOalyKmiY8t7lqqbbgj9yx+84lc6jRBgDKfwQcs/ le+0CSrfgIOKm9w9FEtmjNsQ019r5XkSEP6+yivbWl6BHK8feQuPnsO7OJBzoWMOuBQS xXwDi65nMUBF5g2nNKun0TZQ+vWCymwFF3tyoHPRnRml3nrawQ37ofwBPGHNFM14NNQf x+fXwAJWGKQ1rZ0ChxNvf3s3sNJn5nRPer5MPBIjuK9e5sHWI4wndTVJi2JHYoV6GSZJ 8sNx9S6eqKR9wv8TE77CcNt0lHHeVMlTtFJMv88DJHbfnFvpsyhmE8pV7P/iDOdGuAUQ MRQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rtdKQ4qOY7eJ81qn7DIrL6RA+TOtlT/guME4SLgx8hA=; b=iZ1kQR/+VwpsQ981eTpLUxzDBpmpGSID6yHKdoCiqw2AI/bpIQhTj3MWxC5vhmmu15 lNnKQ23AHIonUTIh2RVNzTI5bbI3dnVBs/T315TK1oSph31d3McyPgby/Q9heO/r+4rC rLrZlYj6EZtc+I/g9tXayY3LdoJTnAc0mdyetTtsRJZ0As2hsk4IVHR4QJVygju5CO0I Ftmjf0gIPYCEBufbbdG2AcVP9jZnXYtVm6391AofneOe0QRLUzonady/NZLIOnEkwEd+ TRdfhVa+XxHrQY5WBbTfnVf7NMjvzw/DlSeJ0LDNto33hXpK6Q7dbwRogro3LiHmBSlz JVeg== X-Gm-Message-State: AOAM5309WHcW5lxUluWcC8H20x7YtXVLEWaEbcp4H3Lt89yeaewW9Qdz RQNV7xrmisOgcYGMLHl/0qXZZg== X-Google-Smtp-Source: ABdhPJy/WhfHbCAR+5T7Jjp14rcTZbIYgUERAB+nV4C3UT3y5r4I9MqV8SK67p86Yt1MDc7rPypqGw== X-Received: by 2002:a05:600c:1492:b0:397:4afc:cc76 with SMTP id c18-20020a05600c149200b003974afccc76mr25153221wmh.124.1654022499653; Tue, 31 May 2022 11:41:39 -0700 (PDT) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6a:b497:0:359:2800:e38d:e04f]) by smtp.gmail.com with ESMTPSA id o16-20020a05600c059000b00397342bcfb7sm2831877wmd.46.2022.05.31.11.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 11:41:39 -0700 (PDT) From: Usama Arif To: io-uring@vger.kernel.org, axboe@kernel.dk, linux-kernel@vger.kernel.org Cc: fam.zheng@bytedance.com, Usama Arif Subject: [PATCH 4/5] io_uring: add symlink opcode for current working directory Date: Tue, 31 May 2022 19:41:24 +0100 Message-Id: <20220531184125.2665210-5-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531184125.2665210-1-usama.arif@bytedance.com> References: <20220531184125.2665210-1-usama.arif@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This provides consistency between io_uring and the respective I/O syscall and avoids having the user of liburing specify the cwd in sqe for IORING_OP_SYMLINKAT. Signed-off-by: Usama Arif --- fs/io_uring.c | 20 +++++++++++++++----- include/uapi/linux/io_uring.h | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 9c9fa0b3938d..4050377619d3 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1312,6 +1312,7 @@ static const struct io_op_def io_op_defs[] =3D { [IORING_OP_UNLINKAT] =3D {}, [IORING_OP_MKDIR] =3D {}, [IORING_OP_MKDIRAT] =3D {}, + [IORING_OP_SYMLINK] =3D {}, [IORING_OP_SYMLINKAT] =3D {}, [IORING_OP_LINKAT] =3D {}, [IORING_OP_MSG_RING] =3D { @@ -1464,6 +1465,8 @@ const char *io_uring_get_opcode(u8 opcode) return "MKDIR"; case IORING_OP_MKDIRAT: return "MKDIRAT"; + case IORING_OP_SYMLINK: + return "SYMLINK"; case IORING_OP_SYMLINKAT: return "SYMLINKAT"; case IORING_OP_LINKAT: @@ -4941,8 +4944,8 @@ static int io_mkdir(struct io_kiocb *req, unsigned in= t issue_flags) return 0; } =20 -static int io_symlinkat_prep(struct io_kiocb *req, - const struct io_uring_sqe *sqe) +static int io_symlink_prep(struct io_kiocb *req, + const struct io_uring_sqe *sqe, bool is_cwd) { struct io_symlink *sl =3D &req->symlink; const char __user *oldpath, *newpath; @@ -4952,7 +4955,10 @@ static int io_symlinkat_prep(struct io_kiocb *req, if (unlikely(req->flags & REQ_F_FIXED_FILE)) return -EBADF; =20 - sl->new_dfd =3D READ_ONCE(sqe->fd); + if (is_cwd) + sl->new_dfd =3D AT_FDCWD; + else + sl->new_dfd =3D READ_ONCE(sqe->fd); oldpath =3D u64_to_user_ptr(READ_ONCE(sqe->addr)); newpath =3D u64_to_user_ptr(READ_ONCE(sqe->addr2)); =20 @@ -4970,7 +4976,7 @@ static int io_symlinkat_prep(struct io_kiocb *req, return 0; } =20 -static int io_symlinkat(struct io_kiocb *req, unsigned int issue_flags) +static int io_symlink(struct io_kiocb *req, unsigned int issue_flags) { struct io_symlink *sl =3D &req->symlink; int ret; @@ -8107,8 +8113,10 @@ static int io_req_prep(struct io_kiocb *req, const s= truct io_uring_sqe *sqe) return io_mkdir_prep(req, sqe, 1); case IORING_OP_MKDIRAT: return io_mkdir_prep(req, sqe, 0); + case IORING_OP_SYMLINK: + return io_symlink_prep(req, sqe, 1); case IORING_OP_SYMLINKAT: - return io_symlinkat_prep(req, sqe); + return io_symlink_prep(req, sqe, 0); case IORING_OP_LINKAT: return io_linkat_prep(req, sqe); case IORING_OP_MSG_RING: @@ -8267,6 +8275,7 @@ static void io_clean_op(struct io_kiocb *req) case IORING_OP_MKDIRAT: putname(req->mkdir.filename); break; + case IORING_OP_SYMLINK: case IORING_OP_SYMLINKAT: putname(req->symlink.oldpath); putname(req->symlink.newpath); @@ -8435,6 +8444,7 @@ static int io_issue_sqe(struct io_kiocb *req, unsigne= d int issue_flags) case IORING_OP_MKDIRAT: ret =3D io_mkdirat(req, issue_flags); break; + case IORING_OP_SYMLINK: case IORING_OP_SYMLINKAT: ret =3D io_symlinkat(req, issue_flags); break; diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 58f2e0611152..74e6b70638ee 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -192,6 +192,7 @@ enum io_uring_op { IORING_OP_RENAME, IORING_OP_UNLINK, IORING_OP_MKDIR, + IORING_OP_SYMLINK, =20 /* this goes last, obviously */ IORING_OP_LAST, --=20 2.25.1 From nobody Thu Apr 30 08:28:45 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC584C433EF for ; Tue, 31 May 2022 18:41:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347115AbiEaSl5 (ORCPT ); Tue, 31 May 2022 14:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347101AbiEaSlq (ORCPT ); Tue, 31 May 2022 14:41:46 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B47DA451 for ; Tue, 31 May 2022 11:41:41 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id f23-20020a7bcc17000000b003972dda143eso1734576wmh.3 for ; Tue, 31 May 2022 11:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ch0z4GLxWhSAQSUlskRiFrLr2UouERYcjJkCx5IZlDI=; b=2TfKkZK+ERXCPWANm00v7HIrcLwM/59MLtjytZfFqSajfcOfZyGtYJ2YS8+qutVbbJ 9YJb7IhXN8weXZ8QwpcpnMT4QBpxWUJ+ybj41/t6yXmO0oGJX7DjAdAagPCei+WJaYLb pI0JuigBY9emmatgiKIRsuITO+Us2gb51yfjJR/HK5Rgtd7WkacpUXovaKlObx0vAAMf yZguppMJHbjIuEuakQogO0ZHLw9RhKZrowqNHIcnXRvuZLpuZkWiiczoow2QLlUmBHz4 k4exUWaJL+TfggIrBgHagTD9prC7/1s9C1t9nzTCyRwaW04NLOkaCCFyxyXTRecbxn7c 1i9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ch0z4GLxWhSAQSUlskRiFrLr2UouERYcjJkCx5IZlDI=; b=wRRtbzGsFR/hxHUUuwrkVSo2OIdZ7yFYIvkRExYyapMaJ8yXDEbgU2Frgje4yyDQ6+ bzhQZrG86by1SSr6rWb9f2WtSyYcR0jUNASM/7oo79sOiEl+Op7GdrqkUn8Pt5MhD0bZ Hwp4V7efWhQGAYRgzPrPcJqkfwamThYQJ4O/dchQr662kpjSWPu8GJuQYErMp9rxJQ1t XofHGgUJJc3Fknzy+Am1Sa73L3pWgEye0rPQQwWzNAkqzIuJtnUATg7b4Vo3UfIYyOLL BbLISC/XD/dzr5s1Pg5ymajye9Y5SCXfxIhvLFmENEGQjZBlWJXtGSIYgDrwXqjKE8Eb O8hg== X-Gm-Message-State: AOAM531FrlGrZ6PAgI/exB9lZGD5AOlOG6WrEdKECU5C3/QIbQu2kLf1 xwfnyzGkN3JQD/YPADwmW8sKpA== X-Google-Smtp-Source: ABdhPJyqFWflMLghxEqXpcoI6WfIprYW+XBaC21a8WFYhSNnxeE3H2E1oWczy/6QRewvyRxJeDWD6Q== X-Received: by 2002:a05:600c:4f4e:b0:39c:1bbb:734f with SMTP id m14-20020a05600c4f4e00b0039c1bbb734fmr3690489wmq.116.1654022500477; Tue, 31 May 2022 11:41:40 -0700 (PDT) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6a:b497:0:359:2800:e38d:e04f]) by smtp.gmail.com with ESMTPSA id o16-20020a05600c059000b00397342bcfb7sm2831877wmd.46.2022.05.31.11.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 11:41:40 -0700 (PDT) From: Usama Arif To: io-uring@vger.kernel.org, axboe@kernel.dk, linux-kernel@vger.kernel.org Cc: fam.zheng@bytedance.com, Usama Arif Subject: [PATCH 5/5] io_uring: add link opcode for current working directory Date: Tue, 31 May 2022 19:41:25 +0100 Message-Id: <20220531184125.2665210-6-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220531184125.2665210-1-usama.arif@bytedance.com> References: <20220531184125.2665210-1-usama.arif@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This provides consistency between io_uring and the respective I/O syscall and avoids having the user of liburing specify the cwd in sqe for IORING_OP_LINKAT. Signed-off-by: Usama Arif --- fs/io_uring.c | 29 ++++++++++++++++++++--------- include/uapi/linux/io_uring.h | 1 + 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 4050377619d3..31dfad3a7312 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1314,6 +1314,7 @@ static const struct io_op_def io_op_defs[] =3D { [IORING_OP_MKDIRAT] =3D {}, [IORING_OP_SYMLINK] =3D {}, [IORING_OP_SYMLINKAT] =3D {}, + [IORING_OP_LINK] =3D {}, [IORING_OP_LINKAT] =3D {}, [IORING_OP_MSG_RING] =3D { .needs_file =3D 1, @@ -1469,6 +1470,8 @@ const char *io_uring_get_opcode(u8 opcode) return "SYMLINK"; case IORING_OP_SYMLINKAT: return "SYMLINKAT"; + case IORING_OP_LINK: + return "LINK"; case IORING_OP_LINKAT: return "LINKAT"; case IORING_OP_MSG_RING: @@ -4991,8 +4994,8 @@ static int io_symlink(struct io_kiocb *req, unsigned = int issue_flags) return 0; } =20 -static int io_linkat_prep(struct io_kiocb *req, - const struct io_uring_sqe *sqe) +static int io_link_prep(struct io_kiocb *req, + const struct io_uring_sqe *sqe, bool is_cwd) { struct io_hardlink *lnk =3D &req->hardlink; const char __user *oldf, *newf; @@ -5002,8 +5005,12 @@ static int io_linkat_prep(struct io_kiocb *req, if (unlikely(req->flags & REQ_F_FIXED_FILE)) return -EBADF; =20 - lnk->old_dfd =3D READ_ONCE(sqe->fd); - lnk->new_dfd =3D READ_ONCE(sqe->len); + if (is_cwd) { + lnk->old_dfd =3D lnk->new_dfd =3D AT_FDCWD; + } else { + lnk->old_dfd =3D READ_ONCE(sqe->fd); + lnk->new_dfd =3D READ_ONCE(sqe->len); + } oldf =3D u64_to_user_ptr(READ_ONCE(sqe->addr)); newf =3D u64_to_user_ptr(READ_ONCE(sqe->addr2)); lnk->flags =3D READ_ONCE(sqe->hardlink_flags); @@ -5022,7 +5029,7 @@ static int io_linkat_prep(struct io_kiocb *req, return 0; } =20 -static int io_linkat(struct io_kiocb *req, unsigned int issue_flags) +static int io_link(struct io_kiocb *req, unsigned int issue_flags) { struct io_hardlink *lnk =3D &req->hardlink; int ret; @@ -8117,8 +8124,10 @@ static int io_req_prep(struct io_kiocb *req, const s= truct io_uring_sqe *sqe) return io_symlink_prep(req, sqe, 1); case IORING_OP_SYMLINKAT: return io_symlink_prep(req, sqe, 0); + case IORING_OP_LINK: + return io_link_prep(req, sqe, 1); case IORING_OP_LINKAT: - return io_linkat_prep(req, sqe); + return io_link_prep(req, sqe, 0); case IORING_OP_MSG_RING: return io_msg_ring_prep(req, sqe); case IORING_OP_FSETXATTR: @@ -8280,6 +8289,7 @@ static void io_clean_op(struct io_kiocb *req) putname(req->symlink.oldpath); putname(req->symlink.newpath); break; + case IORING_OP_LINK: case IORING_OP_LINKAT: putname(req->hardlink.oldpath); putname(req->hardlink.newpath); @@ -8442,14 +8452,15 @@ static int io_issue_sqe(struct io_kiocb *req, unsig= ned int issue_flags) break; case IORING_OP_MKDIR: case IORING_OP_MKDIRAT: - ret =3D io_mkdirat(req, issue_flags); + ret =3D io_mkdir(req, issue_flags); break; case IORING_OP_SYMLINK: case IORING_OP_SYMLINKAT: - ret =3D io_symlinkat(req, issue_flags); + ret =3D io_symlink(req, issue_flags); break; + case IORING_OP_LINK: case IORING_OP_LINKAT: - ret =3D io_linkat(req, issue_flags); + ret =3D io_link(req, issue_flags); break; case IORING_OP_MSG_RING: ret =3D io_msg_ring(req, issue_flags); diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index 74e6b70638ee..41391a762ad1 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -193,6 +193,7 @@ enum io_uring_op { IORING_OP_UNLINK, IORING_OP_MKDIR, IORING_OP_SYMLINK, + IORING_OP_LINK, =20 /* this goes last, obviously */ IORING_OP_LAST, --=20 2.25.1