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=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 BF277C33CB2 for ; Sat, 1 Feb 2020 02:10:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 761C520663 for ; Sat, 1 Feb 2020 02:10:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="xvfUtClq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726548AbgBACKD (ORCPT ); Fri, 31 Jan 2020 21:10:03 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:41701 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726475AbgBACKC (ORCPT ); Fri, 31 Jan 2020 21:10:02 -0500 Received: by mail-pg1-f194.google.com with SMTP id l3so449379pgi.8 for ; Fri, 31 Jan 2020 18:10:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=H5w6I3OS4WZjjlTpvsBmyPnESGojpboh+taS7AUCgO4=; b=xvfUtClqOCuoLdJ/ZRdfM5dQbo5QM8ntjeUBENH8l/BRCSbUD96QR6RXH1ubGsM99Q V6RLOdEGCNa+019hQCLuzoIx7grR48V6/w0D9Ku7KxiI/OmjwkH4ar/ZKALkEmTvpqBx nhXIW6w4nM0FkLPd8EHvcv+EeMO+1r1EJuPIVlL8lS4Kjlbqmr0uIqqsoHrAKpMs3GF9 jpwEjiXpoBKgUUdbaiZguYgg33zPISAkKgIN2KK9ranthjJlptdbuk8G/nFEkQcmdxyB FXpWfGUmuTc3PWr8eIg7WYvQixP3wP4cMuCrbVzZyAlJa88pRYEk22R6F/doh8KkIZU7 +vwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=H5w6I3OS4WZjjlTpvsBmyPnESGojpboh+taS7AUCgO4=; b=Tt7ONbZvI91/4aclv4KeZDtYsz00D8USoCQS++hvJaFLpo04LiP7dZSjGmT560HQR3 Px5yyrlNA8Sr76dJlqNMXm19iSMzjIaEXKA3J/Vp/ftWhogrFv7exu+Z1OzFrwK+V+Tf dmkG63KJa870J7NrEh+2/Kgd/KkbFo2Vfxc+paM2eYQaNbWRHjAuVTS80Uv4BspDTvzL 4+M93Yy0JKJkHu94s+E2cTLrhOhzjZBgFBLOPvGWz0lHzbe79KcxUtxTnynM4uavJPw3 IAkO8A+15EX/9Ib8DCHw5NREAj6Kw3vh8CUTjKO/Bc0LcEKCQmsSap0DvCNfiLyjNrA7 vHlw== X-Gm-Message-State: APjAAAXEOGiLctUJkxsfaZ1hu2XmZhldkyAI+5bVqU6kW/LKehb9QK/a Q1uDSOmZFkI9pddjQDXo0J2/ZHRS++s= X-Google-Smtp-Source: APXvYqyxUdFrg7gok840YZS/l6mgq1lD7uIP+gO4ce+WlI79wghcXrpok74+fc3sDsFCSe3mIM6kPQ== X-Received: by 2002:a63:ba05:: with SMTP id k5mr13097453pgf.158.1580523000535; Fri, 31 Jan 2020 18:10:00 -0800 (PST) Received: from [192.168.1.188] ([66.219.217.145]) by smtp.gmail.com with ESMTPSA id u3sm11568922pjv.32.2020.01.31.18.09.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 31 Jan 2020 18:10:00 -0800 (PST) Subject: Re: [PATCH] io_uring: fix sporadic double CQE entry for close To: Pavel Begunkov , io-uring References: From: Jens Axboe Message-ID: <8ac0d841-0307-d475-be84-ffaaf1c985b3@kernel.dk> Date: Fri, 31 Jan 2020 19:09:58 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: io-uring-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On 1/31/20 5:40 PM, Pavel Begunkov wrote: > On 01/02/2020 03:21, Jens Axboe wrote: >> We punt close to async for the final fput(), but we log the completion >> even before that even in that case. We rely on the request not having >> a files table assigned to detect what the final async close should do. >> However, if we punt the async queue to __io_queue_sqe(), we'll get >> ->files assigned and this makes io_close_finish() think it should both >> close the filp again (which does no harm) AND log a new CQE event for >> this request. This causes duplicate CQEs. >> >> Queue the request up for async manually so we don't grab files >> needlessly and trigger this condition. >> > > Evidently from your 2 last patches, it's becoming hard to track everything in > the current state. As mentioned, I'm going to rework and fix submission and prep > paths with a bit of formalisation. Honestly don't think it's that bad, not unusual to have a bit of fallout from the large amount of changes that just went in. That said, I'm obviously always interested in anything that is clear and hardens the flow. -- Jens Axboe