From patchwork Mon Nov 7 17:56:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 13035035 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 62591C4332F for ; Mon, 7 Nov 2022 18:00:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232788AbiKGSAN (ORCPT ); Mon, 7 Nov 2022 13:00:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232802AbiKGR7r (ORCPT ); Mon, 7 Nov 2022 12:59:47 -0500 Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF35D24F15 for ; Mon, 7 Nov 2022 09:56:23 -0800 (PST) Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.17.1.5/8.17.1.5) with ESMTP id 2A7GlmMm030717 for ; Mon, 7 Nov 2022 09:56:22 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=fviXk0LNnrl5sy4e4CtOb1CjSHn6NFyFT8uwVNkAmF0=; b=ah09K/zJJOQVmAgrVycHLsq3Z79Wib27q9M2d7FBm702V9fbhplzmkV9VLrZXIbbre6V LjVLGeyEYwEqE9xIME9w8TJGHfW2+Ror0Uh1aBQp2Ahy+iLKtnodUBMRQnoeRDo+iwbE yzG47IdjpZe5iWudeCQmBphNrt3dWHKgN3MQynQ7e0w/kTaytFEoAc7dRkub/5ULiMoa FKBlmw0RS2n/6E1pyaxJLCuEsu+jzQMY4BmgUyn7XZTl3WtOqpf0XBydN/2+nFwvoKZD 0bqSTcIo8R1iDEZUlLfsEUYENOZwzoQ48Vrahht74CFLKv70qdI+v4GxvglUiJr0AV0f pQ== Received: from mail.thefacebook.com ([163.114.132.120]) by m0001303.ppops.net (PPS) with ESMTPS id 3knkgvh5t5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 07 Nov 2022 09:56:22 -0800 Received: from twshared2001.03.ash8.facebook.com (2620:10d:c085:108::8) by mail.thefacebook.com (2620:10d:c085:21d::4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 7 Nov 2022 09:56:21 -0800 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id 6682DADF1C99; Mon, 7 Nov 2022 09:56:11 -0800 (PST) From: Keith Busch To: , , CC: , Subject: [PATCH 1/4] iov: add import_ubuf() Date: Mon, 7 Nov 2022 09:56:07 -0800 Message-ID: <20221107175610.349807-2-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221107175610.349807-1-kbusch@meta.com> References: <20221107175610.349807-1-kbusch@meta.com> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: a2WCuMNwfJ5NogcV8YAqrfilcVpcU4GE X-Proofpoint-GUID: a2WCuMNwfJ5NogcV8YAqrfilcVpcU4GE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-07_08,2022-11-07_02,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Jens Axboe Like import_single_range(), but for ITER_UBUF. Signed-off-by: Jens Axboe --- include/linux/uio.h | 1 + lib/iov_iter.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index 2e3134b14ffd..27575495c006 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -337,6 +337,7 @@ ssize_t __import_iovec(int type, const struct iovec __user *uvec, struct iov_iter *i, bool compat); int import_single_range(int type, void __user *buf, size_t len, struct iovec *iov, struct iov_iter *i); +int import_ubuf(int type, void __user *buf, size_t len, struct iov_iter *i); static inline void iov_iter_ubuf(struct iov_iter *i, unsigned int direction, void __user *buf, size_t count) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index c3ca28ca68a6..07adf18e5e40 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1855,6 +1855,17 @@ int import_single_range(int rw, void __user *buf, size_t len, } EXPORT_SYMBOL(import_single_range); +int import_ubuf(int rw, void __user *buf, size_t len, struct iov_iter *i) +{ + if (len > MAX_RW_COUNT) + len = MAX_RW_COUNT; + if (unlikely(!access_ok(buf, len))) + return -EFAULT; + + iov_iter_ubuf(i, rw, buf, len); + return 0; +} + /** * iov_iter_restore() - Restore a &struct iov_iter to the same state as when * iov_iter_save_state() was called. From patchwork Mon Nov 7 17:56:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 13035036 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 06003C4332F for ; Mon, 7 Nov 2022 18:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232625AbiKGSAR (ORCPT ); Mon, 7 Nov 2022 13:00:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232553AbiKGR7u (ORCPT ); Mon, 7 Nov 2022 12:59:50 -0500 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A37342A95D for ; Mon, 7 Nov 2022 09:56:24 -0800 (PST) Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A7Glivq023222 for ; Mon, 7 Nov 2022 09:56:23 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=L3jw1UOj6ixjglp00dy1V087hjPkrNjvSa5Six2yGI0=; b=M9ZqP5hok/+fvIkhOQjZnDGyICKctDvZD2af06hYRhVQrIT0I5R1DwRvlKCf/iwVMeot rOMpxVG2phTo7Fd6Uo1xnrNJ8keushyttYBf70d3Q/K7ZzrxZ+FuN2rUNLTXzEO8tGwp IB/7roO7MZ1RswdW3hQ/SonoJEaCrltoU3uGWjTuf+yWw0CxokdpWL8JjGCTvmPQSMXO J7EtxuaOOQ5Da/56zqXZYAXggZWHAcmgb7EyTlRCi4lT+LzM9wlDKx1wd50+mL/Cg70W v5nHCwXQFaqCO4tLF4LCKyKOraPGt+gT9sK8epBYU/ctZM23trjAHzCrISX6LXHuBwaa aQ== Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3knnbyrfye-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 07 Nov 2022 09:56:23 -0800 Received: from twshared5287.03.ash8.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:83::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 7 Nov 2022 09:56:20 -0800 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id 7EDBDADF1C9B; Mon, 7 Nov 2022 09:56:11 -0800 (PST) From: Keith Busch To: , , CC: , , Keith Busch Subject: [PATCH 2/4] io_uring: switch network send/recv to ITER_UBUF Date: Mon, 7 Nov 2022 09:56:08 -0800 Message-ID: <20221107175610.349807-3-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221107175610.349807-1-kbusch@meta.com> References: <20221107175610.349807-1-kbusch@meta.com> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: BZxtv45oq6EX0K2pLoVlM7qFjU1J49jc X-Proofpoint-GUID: BZxtv45oq6EX0K2pLoVlM7qFjU1J49jc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-07_08,2022-11-07_02,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Jens Axboe This is more efficient than ITER_IOVEC. Signed-off-by: Jens Axboe [merged to 6.1] Signed-off-by: Keith Busch --- io_uring/net.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/io_uring/net.c b/io_uring/net.c index 9a07e79cc0e6..12c68b5ec62d 100644 --- a/io_uring/net.c +++ b/io_uring/net.c @@ -170,7 +170,7 @@ static int io_setup_async_msg(struct io_kiocb *req, if (async_msg->msg.msg_name) async_msg->msg.msg_name = &async_msg->addr; /* if were using fast_iov, set it to the new one */ - if (!kmsg->free_iov) { + if (iter_is_iovec(&kmsg->msg.msg_iter) && !kmsg->free_iov) { size_t fast_idx = kmsg->msg.msg_iter.iov - kmsg->fast_iov; async_msg->msg.msg_iter.iov = &async_msg->fast_iov[fast_idx]; } @@ -333,7 +333,6 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags) struct sockaddr_storage __address; struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); struct msghdr msg; - struct iovec iov; struct socket *sock; unsigned flags; int min_ret = 0; @@ -367,7 +366,7 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags) if (unlikely(!sock)) return -ENOTSOCK; - ret = import_single_range(WRITE, sr->buf, sr->len, &iov, &msg.msg_iter); + ret = import_ubuf(WRITE, sr->buf, sr->len, &msg.msg_iter); if (unlikely(ret)) return ret; @@ -752,10 +751,7 @@ int io_recvmsg(struct io_kiocb *req, unsigned int issue_flags) } } - kmsg->fast_iov[0].iov_base = buf; - kmsg->fast_iov[0].iov_len = len; - iov_iter_init(&kmsg->msg.msg_iter, READ, kmsg->fast_iov, 1, - len); + iov_iter_ubuf(&kmsg->msg.msg_iter, READ, buf, len); } flags = sr->msg_flags; @@ -824,7 +820,6 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags) struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); struct msghdr msg; struct socket *sock; - struct iovec iov; unsigned int cflags; unsigned flags; int ret, min_ret = 0; @@ -849,7 +844,7 @@ int io_recv(struct io_kiocb *req, unsigned int issue_flags) sr->buf = buf; } - ret = import_single_range(READ, sr->buf, len, &iov, &msg.msg_iter); + ret = import_ubuf(READ, sr->buf, len, &msg.msg_iter); if (unlikely(ret)) goto out_free; From patchwork Mon Nov 7 17:56:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 13035034 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 D133FC43219 for ; Mon, 7 Nov 2022 18:00:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232105AbiKGSAH (ORCPT ); Mon, 7 Nov 2022 13:00:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232420AbiKGR7p (ORCPT ); Mon, 7 Nov 2022 12:59:45 -0500 Received: from mx0a-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA8AC2A959 for ; Mon, 7 Nov 2022 09:56:21 -0800 (PST) Received: from pps.filterd (m0089730.ppops.net [127.0.0.1]) by m0089730.ppops.net (8.17.1.5/8.17.1.5) with ESMTP id 2A7Glfk7028694 for ; Mon, 7 Nov 2022 09:56:21 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=QnMdpgYmbsjbHhQ1lDDFeQrvaJxuQSXg0MrwT8Db3lk=; b=fs97lz8jkDdcsspWBSL8QgngIhy2g4fNGPgQFaUKngtVgj6HawGHH5uNlNNIbVw7Ml5/ Ap2FohdIEeoRQ4d22N2yHIhjf/aBccDybNcQRj9N/SyY00sYnDb90Qq+CsxjWkCMc5Tv fvxLiwN9cZaSp/AJAb4OTtcYkmiXdpHq2uSaasiCRYMpalunfUK+Kqq2/j7UiNM6jwbk QpCTVoozLTvqGA+S8+s5XqdEU5jtZBMU4XwZLIM/k1cYl8ZfbFIS0NYr714myN5Yf/Uc sCE4bndFhVw/18U3yBBe6GkYSo97jN9J4319+0vrZRNdG8yQzm8JQ85ulgIj8hFkoPgK 9g== Received: from mail.thefacebook.com ([163.114.132.120]) by m0089730.ppops.net (PPS) with ESMTPS id 3knkb819w1-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 07 Nov 2022 09:56:21 -0800 Received: from snc-exhub201.TheFacebook.com (2620:10d:c085:21d::7) by snc-exhub101.TheFacebook.com (2620:10d:c085:11d::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 7 Nov 2022 09:56:19 -0800 Received: from twshared27579.05.ash9.facebook.com (2620:10d:c085:108::8) by mail.thefacebook.com (2620:10d:c085:21d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 7 Nov 2022 09:56:18 -0800 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id 995E8ADF1C9D; Mon, 7 Nov 2022 09:56:11 -0800 (PST) From: Keith Busch To: , , CC: , , Keith Busch Subject: [PATCH 3/4] io_uring: use ubuf for single range imports for read/write Date: Mon, 7 Nov 2022 09:56:09 -0800 Message-ID: <20221107175610.349807-4-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221107175610.349807-1-kbusch@meta.com> References: <20221107175610.349807-1-kbusch@meta.com> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-GUID: f1vqFxYeCvKCkMNp-kgIzRgCnavgfncp X-Proofpoint-ORIG-GUID: f1vqFxYeCvKCkMNp-kgIzRgCnavgfncp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-07_08,2022-11-07_02,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Jens Axboe This is more efficient than ITER_IOVEC. Signed-off-by: Jens Axboe [merge to 6.1, random fixes] Signed-off-by: Keith Busch --- io_uring/rw.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/io_uring/rw.c b/io_uring/rw.c index 1ce065709724..19551b5e8088 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -391,7 +391,7 @@ static struct iovec *__io_import_iovec(int ddir, struct io_kiocb *req, rw->len = sqe_len; } - ret = import_single_range(ddir, buf, sqe_len, s->fast_iov, iter); + ret = import_ubuf(ddir, buf, sqe_len, iter); if (ret) return ERR_PTR(ret); return NULL; @@ -450,7 +450,10 @@ static ssize_t loop_rw_iter(int ddir, struct io_rw *rw, struct iov_iter *iter) struct iovec iovec; ssize_t nr; - if (!iov_iter_is_bvec(iter)) { + if (iter_is_ubuf(iter)) { + iovec.iov_base = iter->ubuf + iter->iov_offset; + iovec.iov_len = iov_iter_count(iter); + } else if (!iov_iter_is_bvec(iter)) { iovec = iov_iter_iovec(iter); } else { iovec.iov_base = u64_to_user_ptr(rw->addr); @@ -495,7 +498,7 @@ static void io_req_map_rw(struct io_kiocb *req, const struct iovec *iovec, io->free_iovec = iovec; io->bytes_done = 0; /* can only be fixed buffers, no need to do anything */ - if (iov_iter_is_bvec(iter)) + if (iov_iter_is_bvec(iter) || iter_is_ubuf(iter)) return; if (!iovec) { unsigned iov_off = 0; From patchwork Mon Nov 7 17:56:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Busch X-Patchwork-Id: 13035032 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 DBCEBC433FE for ; Mon, 7 Nov 2022 18:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232599AbiKGR77 (ORCPT ); Mon, 7 Nov 2022 12:59:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232636AbiKGR7l (ORCPT ); Mon, 7 Nov 2022 12:59:41 -0500 Received: from mx0a-00082601.pphosted.com (mx0a-00082601.pphosted.com [67.231.145.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 617A62A718 for ; Mon, 7 Nov 2022 09:56:21 -0800 (PST) Received: from pps.filterd (m0148461.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A7Glixp007970 for ; Mon, 7 Nov 2022 09:56:21 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=meta.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=s2048-2021-q4; bh=IrY4FfXRGP3pHaS7CSwjdJr9fKO0nPIkNCwM9wSvb68=; b=mWEUF2nkXD3j+I+tgK86OdnSPMhwn1i9moNNp1lJzMS4nR2EaWLCnns6NiNVX4NGKeRj CIOxnufDsrElrXJeksU/asCbU+JUVxHmdM8otUvvYKZF2FnW+96rZ2sfkEHawKheQ4iD BOH5UocvIa6ojjG8kayoefJwp+yxMr1oWopl1wttJ0b0EFSq8BBBQb/m4FlMeMjrBvLc GUgnCg2mC0B1lUEbne08RiZEG6/nYkVwTCevTc6PI5SHx7W5TDdNJ/e8PQx4i5e9Jf0h jm5IeiRH4IGDpYIwWLDCA1KMIpcsIG3t30LGpq/lKuCh3ULlqyTGuP07AR9ESfKohzwA dw== Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3knmxss1mw-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 07 Nov 2022 09:56:20 -0800 Received: from twshared27579.05.ash9.facebook.com (2620:10d:c085:108::8) by mail.thefacebook.com (2620:10d:c085:21d::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 7 Nov 2022 09:56:19 -0800 Received: by devbig007.nao1.facebook.com (Postfix, from userid 544533) id B1BA2ADF1C9E; Mon, 7 Nov 2022 09:56:11 -0800 (PST) From: Keith Busch To: , , CC: , , Keith Busch Subject: [PATCH 4/4] iov_iter: move iter_ubuf check inside restore WARN Date: Mon, 7 Nov 2022 09:56:10 -0800 Message-ID: <20221107175610.349807-5-kbusch@meta.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221107175610.349807-1-kbusch@meta.com> References: <20221107175610.349807-1-kbusch@meta.com> MIME-Version: 1.0 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: p5e9Mc6lOPVzXRRtGun_QocCUgHUjtgH X-Proofpoint-GUID: p5e9Mc6lOPVzXRRtGun_QocCUgHUjtgH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-07_08,2022-11-07_02,2022-06-22_01 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Keith Busch io_uring is using iter_ubuf types for single vector requests. We expect state restore may happen for this type now, and it is already handled correctly, so move the check inside the warning to suppress it. Signed-off-by: Keith Busch --- lib/iov_iter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 07adf18e5e40..aa192a386bd7 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1880,8 +1880,8 @@ int import_ubuf(int rw, void __user *buf, size_t len, struct iov_iter *i) */ void iov_iter_restore(struct iov_iter *i, struct iov_iter_state *state) { - if (WARN_ON_ONCE(!iov_iter_is_bvec(i) && !iter_is_iovec(i)) && - !iov_iter_is_kvec(i) && !iter_is_ubuf(i)) + if (WARN_ON_ONCE(!iov_iter_is_bvec(i) && !iter_is_iovec(i) && + !iter_is_ubuf(i)) && !iov_iter_is_kvec(i)) return; i->iov_offset = state->iov_offset; i->count = state->count;