From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2588C433DF for ; Fri, 3 Jul 2020 19:17:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 955472088E for ; Fri, 3 Jul 2020 19:17:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="by8N9ugL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726368AbgGCTRH (ORCPT ); Fri, 3 Jul 2020 15:17:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbgGCTRH (ORCPT ); Fri, 3 Jul 2020 15:17:07 -0400 Received: from mail-ej1-x644.google.com (mail-ej1-x644.google.com [IPv6:2a00:1450:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5790C061794 for ; Fri, 3 Jul 2020 12:17:06 -0700 (PDT) Received: by mail-ej1-x644.google.com with SMTP id dr13so35354989ejc.3 for ; Fri, 03 Jul 2020 12:17:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EpP0j+IKaFN+/2k/d95m4TP8TDYLgokhMFlDnjQRKRQ=; b=by8N9ugLS487CrzT/a6O9n+Zjo4vx+alrHW8Fl7yeZORga7lDWkWSds5MfwREKujET m8ccWbrcXP0/0KTyTOMys7KGJ4wjJ+/JMxEoiFQo5mjF9CE0g7XsZ4yLUHbAwJDGh6iX MG4EOUmyAzAZ/gD8/Z1s5vDYk0+4t0T/SaUL/a/Wc9nbZ5HREbPEaB1sqNJV3xC/f6dm 8QZePnaHOm4uIPwpg86HZOAuPqIsd0mX/e0yNjNeDBrDCkWKr9ZZBytjmEXP1Kf8RfAa 1h4FMFfkdebundImQbM+XxF7LRppIDBQTH499PMhUrGyYeSQzgr+1/pY+5+93WMA1uI2 ujXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EpP0j+IKaFN+/2k/d95m4TP8TDYLgokhMFlDnjQRKRQ=; b=GaIdVsq8ST2aGJxGa5L6AORcJHgLltr/KbYkwsR67EW6CsOQzEnuxFEza1LEBDA3qv vJG7NEu/9pudd8igQRlgYa6No5Wh8J+wqyR80ALViowZUNw2tb+mQ9CC3pjgJNLQN+vc 6Yze5n278OYb+MXAtawGXFLHKqxPMixcdPsXSBFEal7+CFeR0jazvwhYn0xaoCS2w0sv kU+TYyrVu0vA3WQuVXCk83MY61WO3VPB8rIZJr5Z+NzkimmeYU34e7ehNv3hAzW4cUsB /FTpFmJhAyJV+592ypX+hPhcidTAr8YeICVG771Vd8kU7ZkS6jewLEMucpuXWZX7RrjI qnbA== X-Gm-Message-State: AOAM532q7LEGrzRm5fX9PpkhbMgLkfECoDq3HtHRfKT2kSeuiJnQDUJD BrN2LCQv8tgjCCibTg8cbNU= X-Google-Smtp-Source: ABdhPJyTuOSkkC+fDLwADiwuRpCglJG2ciXwGFbobSUBHqu/7A4XkW9cxYLPQzr/p2x1+EAGqKCp8g== X-Received: by 2002:a17:906:5657:: with SMTP id v23mr34685276ejr.196.1593803825512; Fri, 03 Jul 2020 12:17:05 -0700 (PDT) Received: from localhost.localdomain ([5.100.193.85]) by smtp.gmail.com with ESMTPSA id p9sm9907883ejd.50.2020.07.03.12.17.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 12:17:05 -0700 (PDT) From: Pavel Begunkov To: Jens Axboe , io-uring@vger.kernel.org Subject: [PATCH 2/3] io_uring: keep queue_sqe()'s fail path separately Date: Fri, 3 Jul 2020 22:15:07 +0300 Message-Id: X-Mailer: git-send-email 2.24.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: io-uring-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org A preparataion path, extracts error path into a separate block. It looks saner then calling req_set_fail_links() after io_put_req_find_next(), even though it have been working well. Signed-off-by: Pavel Begunkov --- fs/io_uring.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index f0fed59122e8..d61d8bc0cfc0 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5930,22 +5930,21 @@ static void __io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe, goto exit; } + if (unlikely(ret)) { err: - /* drop submission reference */ - nxt = io_put_req_find_next(req); - - if (linked_timeout) { - if (!ret) - io_queue_linked_timeout(linked_timeout); - else - io_put_req(linked_timeout); - } - - /* and drop final reference, if we failed */ - if (ret) { + /* un-prep timeout, so it'll be killed as any other linked */ + req->flags &= ~REQ_F_LINK_TIMEOUT; req_set_fail_links(req); + io_put_req(req); io_req_complete(req, ret); + goto exit; } + + /* drop submission reference */ + nxt = io_put_req_find_next(req); + if (linked_timeout) + io_queue_linked_timeout(linked_timeout); + if (nxt) { req = nxt; -- 2.24.0