From patchwork Tue May 31 18:41:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 12866017 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 C456BC433FE for ; Tue, 31 May 2022 18:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347112AbiEaSlr (ORCPT ); Tue, 31 May 2022 14:41:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347084AbiEaSlk (ORCPT ); Tue, 31 May 2022 14:41:40 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7201F207 for ; Tue, 31 May 2022 11:41:38 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id p10so19828478wrg.12 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=BYIR1Cbyjw6bP/u3gUvG2YYIe4q1mOmB58oxM6prtexZGAn9SGt8Xr+L9dy2WK62Wv BVEHGi1G9YGmaTWqCwNy6E6ITuKS3aI32TDTJXi7N61cXEWwyVi/8gUZQzorr0+7FI/Y ysb1krk2Y3+rx1y/ycqQYYr1bKuAHTMM/NQHwZ/HUJ2w3fjNgJu/Sg5IGORxUgEYfrSx gC7vmn2BGEDBN+UxeWk8x4OpnTPFwr0mYAUqWxrmhHUkembKDN0dYEGcuRxaI78gscII fC2yTO7cC6CxBImCwcw5EDpjQegwNb7mSEuzJneucAFJY+1d9a2RkGFCreiQipWSbgS+ 9T6g== X-Gm-Message-State: AOAM532mBGyQ7C/RLriKjFdB5fQKafHrcOF8fan2dhNHQTvAHqCQAi8E bdO1l7+UNZQyqojWhdrzGMym4tyu5450t3+s 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 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org 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[] = { [IORING_OP_SHUTDOWN] = { .needs_file = 1, }, + [IORING_OP_RENAME] = {}, [IORING_OP_RENAMEAT] = {}, [IORING_OP_UNLINKAT] = {}, [IORING_OP_MKDIRAT] = {}, @@ -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 int issue_flags) return ret; } -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 = &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; - ren->old_dfd = READ_ONCE(sqe->fd); + if (is_cwd) { + ren->old_dfd = ren->new_dfd = AT_FDCWD; + } else { + ren->old_dfd = READ_ONCE(sqe->fd); + ren->new_dfd = READ_ONCE(sqe->len); + } oldf = u64_to_user_ptr(READ_ONCE(sqe->addr)); newf = u64_to_user_ptr(READ_ONCE(sqe->addr2)); - ren->new_dfd = READ_ONCE(sqe->len); ren->flags = READ_ONCE(sqe->rename_flags); ren->oldpath = getname(oldf); @@ -4584,7 +4591,7 @@ static int io_renameat_prep(struct io_kiocb *req, return 0; } -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 = &req->rename; int ret; @@ -8076,8 +8083,10 @@ static int io_req_prep(struct io_kiocb *req, const struct 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, unsigned int issue_flags) case IORING_OP_SHUTDOWN: ret = io_shutdown(req, issue_flags); break; + case IORING_OP_RENAME: case IORING_OP_RENAMEAT: - ret = io_renameat(req, issue_flags); + ret = io_rename(req, issue_flags); break; case IORING_OP_UNLINKAT: ret = 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, /* this goes last, obviously */ IORING_OP_LAST, From patchwork Tue May 31 18:41:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 12866016 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 38AC1C4332F for ; Tue, 31 May 2022 18:41:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347084AbiEaSls (ORCPT ); Tue, 31 May 2022 14:41:48 -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 S1347086AbiEaSlm (ORCPT ); Tue, 31 May 2022 14:41:42 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C508B7B for ; Tue, 31 May 2022 11:41:39 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id k16so15507251wrg.7 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=gsETjhS9oMRSveCgsuUdWz3B5Qgyzhrj9/HCtK9JNedjP01+EbYeVZFAnrTc+mumVG 9saR2eW7kXQN9Fx4QRHmgTeRK3kH2VewCAyVF81u1IGWRLIiW7D54esjAu0c5pAXQ8DG BwzDzH/WDLAolHExghCanTOJB6ssr5bqUwJkLi+iBdBTbaWmuehfiwm2Yij6UdMSC2y7 LN8KFnZ5vRoAC0NIOfQM6HlRserflp9Oxe3gVN38g/tnkoz6txvzlmRLkHue9uJtsSvc xpNy+8TklhQe4lGzZZAfyL9Ini3OCFQt2fYAq4ebVpAPBal2n8DHdm0vGbhM/78NPCt1 kj9A== X-Gm-Message-State: AOAM532wvZD6DJ/daXLjA/Jc6aNVTXb6naU5H+wo/UCSUnzI90hJCZDY vta1kxZTcmTK+hRsRxymsgzuM7zKp2PxmaR5 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 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org 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[] = { }, [IORING_OP_RENAME] = {}, [IORING_OP_RENAMEAT] = {}, + [IORING_OP_UNLINK] = {}, [IORING_OP_UNLINKAT] = {}, [IORING_OP_MKDIRAT] = {}, [IORING_OP_SYMLINKAT] = {}, @@ -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; } -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 = &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; - un->dfd = READ_ONCE(sqe->fd); + if (is_cwd) + un->dfd = AT_FDCWD; + else + un->dfd = READ_ONCE(sqe->fd); un->flags = 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; } -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 = &req->unlink; int ret; @@ -8087,8 +8093,10 @@ static int io_req_prep(struct io_kiocb *req, const struct 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, unsigned int issue_flags) case IORING_OP_RENAMEAT: ret = io_rename(req, issue_flags); break; + case IORING_OP_UNLINK: case IORING_OP_UNLINKAT: - ret = io_unlinkat(req, issue_flags); + ret = io_unlink(req, issue_flags); break; case IORING_OP_MKDIRAT: ret = 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, /* this goes last, obviously */ IORING_OP_LAST, From patchwork Tue May 31 18:41:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 12866020 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 3BD31C43217 for ; Tue, 31 May 2022 18:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347106AbiEaSlv (ORCPT ); Tue, 31 May 2022 14:41:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347095AbiEaSlq (ORCPT ); Tue, 31 May 2022 14:41:46 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 848E9E15 for ; Tue, 31 May 2022 11:41:40 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id o29-20020a05600c511d00b00397697f172dso1573900wms.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=E5sImIk3F/WBMjrNV+SixNkDeE9PuoqYJJOzte4vedanyGkIFTKutTluejFMnj9YBc DlmlGeIg1o1mA/IyLSJmHRMSBUTuX/lybGp+WhGUVYhguCZepVL9Ireml2KvzuTt4oYS 14Ng9d72VfOcM9Ee3MPGwcZ6Q+8fxbPki5nhpBR1YxMwDZAUHIhJ3p4HKOKxtMODq/DC Ui00vMQInzaoXKlFB+8PWcdb4kgs2tj05PqDpCQ8Wig1htHlhy7RJhX7qx3Dk5Tt5Qfm M2nLYEqtEUpYc1Py49XmLLr16XI7V+wNLtmd44zHW1L/Ot5fYpfOgu7Hg4mhyA8OPiXS 7rFg== X-Gm-Message-State: AOAM530jHnlrM3GW/CYYy84erUJLpk8SWbwYs+0HenB15DlOEiWmPo4g cmNTkAUsBc3MNxYhitezSBlp+eS4PzmQFuJ5 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 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org 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[] = { [IORING_OP_RENAMEAT] = {}, [IORING_OP_UNLINK] = {}, [IORING_OP_UNLINKAT] = {}, + [IORING_OP_MKDIR] = {}, [IORING_OP_MKDIRAT] = {}, [IORING_OP_SYMLINKAT] = {}, [IORING_OP_LINKAT] = {}, @@ -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 int issue_flags) return 0; } -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 = &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; - mkd->dfd = READ_ONCE(sqe->fd); + if (is_cwd) + mkd->dfd = AT_FDCWD; + else + mkd->dfd = READ_ONCE(sqe->fd); mkd->mode = READ_ONCE(sqe->len); fname = u64_to_user_ptr(READ_ONCE(sqe->addr)); @@ -4920,7 +4926,7 @@ static int io_mkdirat_prep(struct io_kiocb *req, return 0; } -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 = &req->mkdir; int ret; @@ -8097,8 +8103,10 @@ static int io_req_prep(struct io_kiocb *req, const struct 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, unsigned int issue_flags) case IORING_OP_UNLINKAT: ret = io_unlink(req, issue_flags); break; + case IORING_OP_MKDIR: case IORING_OP_MKDIRAT: ret = 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, /* this goes last, obviously */ IORING_OP_LAST, From patchwork Tue May 31 18:41:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 12866019 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 D091BC433EF for ; Tue, 31 May 2022 18:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347093AbiEaSlt (ORCPT ); Tue, 31 May 2022 14:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347103AbiEaSlq (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 1AF4F9FDA for ; Tue, 31 May 2022 11:41:41 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id f7-20020a1c3807000000b0039c1a10507fso1665143wma.1 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=N56HTkRrh+McDrOyaX7tyNnssE9Rlq/pdA6zFTAaQgA0uNHBwPq/pkNOUp06Zbzva3 v3xH0Pkmdfc6SJoCfYv7svAxirGO+OUdkX+Nfi1wY20IAv1zm3vndclhsX6lPBMor6Np F3Lg1xQFgZOfMOfOUR0BM8dONQU4YJUSvKixBwVN4rps71+M/AUhvrfiYVBkvYCBzqZz fGTxEm+nJZPwFSpcKHMzrnuKxmyTbRzaS6t82GqfdBfTVGFJGZF6EkLnAjmz4vLbtLdS sGUh1nX5ECs2afIsLRGct+M3JNUv2KgQhwUHUI5xdDpZ3ROBPVN+EGqcjs2giqcJ6Mpj 2QUA== X-Gm-Message-State: AOAM532p+VtnjjuZTHFRWmmF8WmwzVChJ7hyVsdHx1PW7S+OH6AJHOnw wCLVNwWDoRAkfkT2PKXIUr2A3+heBUq2oxWQ 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 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org 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[] = { [IORING_OP_UNLINKAT] = {}, [IORING_OP_MKDIR] = {}, [IORING_OP_MKDIRAT] = {}, + [IORING_OP_SYMLINK] = {}, [IORING_OP_SYMLINKAT] = {}, [IORING_OP_LINKAT] = {}, [IORING_OP_MSG_RING] = { @@ -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 int issue_flags) return 0; } -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 = &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; - sl->new_dfd = READ_ONCE(sqe->fd); + if (is_cwd) + sl->new_dfd = AT_FDCWD; + else + sl->new_dfd = READ_ONCE(sqe->fd); oldpath = u64_to_user_ptr(READ_ONCE(sqe->addr)); newpath = u64_to_user_ptr(READ_ONCE(sqe->addr2)); @@ -4970,7 +4976,7 @@ static int io_symlinkat_prep(struct io_kiocb *req, return 0; } -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 = &req->symlink; int ret; @@ -8107,8 +8113,10 @@ static int io_req_prep(struct io_kiocb *req, const struct 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, unsigned int issue_flags) case IORING_OP_MKDIRAT: ret = io_mkdirat(req, issue_flags); break; + case IORING_OP_SYMLINK: case IORING_OP_SYMLINKAT: ret = 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, /* this goes last, obviously */ IORING_OP_LAST, From patchwork Tue May 31 18:41:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 12866018 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 6670CC433F5 for ; Tue, 31 May 2022 18:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347063AbiEaSls (ORCPT ); Tue, 31 May 2022 14:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347104AbiEaSlq (ORCPT ); Tue, 31 May 2022 14:41:46 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B65DA470 for ; Tue, 31 May 2022 11:41:41 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id r123-20020a1c2b81000000b0039c1439c33cso1680890wmr.5 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=z2fHzz97Psw8Uk87qo4tBJLtF841CZtBO+gtEP2mOR9qBghULXbe69R9spAlRSyFfn RnE3VXBqUiPRz/ttdoIIFc7Cy4hY0bW+q7dtU5XX00WUZOhDfTL/vrlfXS4Xbkfd2IxH VIq7riwXEESsaEgK+SVjPiuegJc7Ib6nB6BW4oDKVIpL2C5FBjpoqa+FFWJBIzvBmX3N awfolkHv2T7yi8CybhCiV+AbaupCa+93FO899Oqk9tZ8FauCc+HYo2zXHdC0rdm9DH6B p9F6bEvEAx6YkHt9CUriQngXlbZNKe9QUqjyFIrWjjIWzh4AUmfOFiCKmteoCJGmDizX yXDw== X-Gm-Message-State: AOAM532hddGnnSi9GlZ+XAPVRo6s1PRzgSHsM6PsBjE7aEt3665A3V/2 yM/gZb39w2kJR+GG/2x1X441Bhn+8lsVbR9E 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 Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org 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[] = { [IORING_OP_MKDIRAT] = {}, [IORING_OP_SYMLINK] = {}, [IORING_OP_SYMLINKAT] = {}, + [IORING_OP_LINK] = {}, [IORING_OP_LINKAT] = {}, [IORING_OP_MSG_RING] = { .needs_file = 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; } -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 = &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; - lnk->old_dfd = READ_ONCE(sqe->fd); - lnk->new_dfd = READ_ONCE(sqe->len); + if (is_cwd) { + lnk->old_dfd = lnk->new_dfd = AT_FDCWD; + } else { + lnk->old_dfd = READ_ONCE(sqe->fd); + lnk->new_dfd = READ_ONCE(sqe->len); + } oldf = u64_to_user_ptr(READ_ONCE(sqe->addr)); newf = u64_to_user_ptr(READ_ONCE(sqe->addr2)); lnk->flags = READ_ONCE(sqe->hardlink_flags); @@ -5022,7 +5029,7 @@ static int io_linkat_prep(struct io_kiocb *req, return 0; } -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 = &req->hardlink; int ret; @@ -8117,8 +8124,10 @@ static int io_req_prep(struct io_kiocb *req, const struct 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, unsigned int issue_flags) break; case IORING_OP_MKDIR: case IORING_OP_MKDIRAT: - ret = io_mkdirat(req, issue_flags); + ret = io_mkdir(req, issue_flags); break; case IORING_OP_SYMLINK: case IORING_OP_SYMLINKAT: - ret = io_symlinkat(req, issue_flags); + ret = io_symlink(req, issue_flags); break; + case IORING_OP_LINK: case IORING_OP_LINKAT: - ret = io_linkat(req, issue_flags); + ret = io_link(req, issue_flags); break; case IORING_OP_MSG_RING: ret = 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, /* this goes last, obviously */ IORING_OP_LAST,