Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1740914pxb; Fri, 20 Nov 2020 18:43:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwIZOh1Z23aYBQZO/zXiUZ9pJslcEHgYS96fpbysFrxtkVSO7GIWs8peOTpSsobxydertlp X-Received: by 2002:a50:d315:: with SMTP id g21mr38917669edh.84.1605926607241; Fri, 20 Nov 2020 18:43:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605926607; cv=none; d=google.com; s=arc-20160816; b=eSnqRh7w4nRN5F8sTanocNCMnetdAQyX4HwtxhCZu2jLVO7VxIjspNFugEdLXmD+1P 2NKWnUF2hNm9WXdxHs7gusQEg+fOjqIoQRMlL3bHNtrx9R+V6CsDzY+EDUBCv6oC5Ey6 DFODJusGxU4S0HridxcpJhxicXyBIzqmWHoSGRigKr0lwzarxZaAXMOgYqpOOPMSLJTQ Z4gxEJhCfjrx7hqqbOWYKMedG0UhQ8M6sHjPZhhyf5hRr2JOdX+o5WmYs0/KfIOPBS3Y 5pkT06CUfwyAfbfwLaD+ceXi3+vtDFbynalkzlPV5TNkxSwn0g9dpWfg2zYH3HWwf4eQ Tisw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=cupvgOMTVBwgkkLbVCBqW4EIqgBQFYF/NJXddxs0Ids=; b=B8ULK3V9PJZ/TDauKWElLxLA6nPdczp+Z9fWvKatgyQrX2UVxS1wwEly7w4/hE3AtI 4qUgIWDl0nD2kHS+EE3ipmaSPY3vSDtX/EuDCS4wW8m2UswQ9RotFL6y7YzF1w3dIj1l hgXjbNzruCWRFvihrg/vHyI4BMz+CDCnRI4cXScsahXNhBwd1nCMbEfJNb5H8/pAtm3Z 4KiwknvFu71BGPzj+9zK/2SZCMK4kz24bQglqfpG4x8tj745ssfwsmTLylTZYyeevRrQ gVDMcV60ZBPbk2BUtmbkFbMKusRiyop7nut3rqtuJ8cpKEodBgW76jfYlYAsTEDf7lnq yfgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=lok14dlo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si2918344edw.337.2020.11.20.18.43.04; Fri, 20 Nov 2020 18:43:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=lok14dlo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726483AbgKUClf (ORCPT + 99 others); Fri, 20 Nov 2020 21:41:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726332AbgKUClf (ORCPT ); Fri, 20 Nov 2020 21:41:35 -0500 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E276CC0613CF for ; Fri, 20 Nov 2020 18:41:33 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id f18so8930386pgi.8 for ; Fri, 20 Nov 2020 18:41:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=cupvgOMTVBwgkkLbVCBqW4EIqgBQFYF/NJXddxs0Ids=; b=lok14dlodxTxd9wKn3eNEOoZBxck6S1fvcVxPO5TKkdTvSC0GSpU11sa6g68umZCfd gl/5tUH5791LPuiP9+fVn+cxF7+mF5LswxE3V2c1Y/3oseQZ1bV7vTWllEYErR3BMFjW xqhT4kBVsiMMZelG0kWMTzwzu66yhebsQBGX/eBl5Gd77OW+uvuvoREdZfGwKyR9okWJ Ku8pxK+rRJZvKaO/PqaN0CGztAullrVUBTqdKxfAiqpHOjS/FNkBv8qo8vmOPqj8ZU9a uiDV9i7LwjXmBQQmQyWp74PC7XAUDEf5Lasf3EVigZziYbIcT2IAwzDc6ZVBVzoeUEjt JmEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cupvgOMTVBwgkkLbVCBqW4EIqgBQFYF/NJXddxs0Ids=; b=QcH08Uil1Lwy2AlGtdxFmiat1wJSKwd0DPzYJG5p1oiuoUGxe748KaNQQGM1/oibnp uBQF2zaeDRb4I8kYJHeTCqvm7ISxFYtaAay5XVffitdLvy/so6/08ZBux/0Vl0IVJtIL ptgekU7PyX1VOR79WtICXTM4wseMRfmoy74FO35UHeo3JnowiqypYoPqnt9O4jkvx8Pq iRfa0ElbtSH4b+oR0ivmFyTcIQ0EOFX15P1z//hmRWuldaCC1RXR2kHlK5fVBlA8SgNB /xIAfUAc3BtzfMaUeW53e7W8Ip5RS+jBC7WQOpatRyO/QIFe6TBj35rE5jQ6uCs44Sy/ i82Q== X-Gm-Message-State: AOAM533H2emOfbOoa8vPm1ONimas+6Ed2ddv9X9EpErq62ClRHF9Uxfw QkX2IgYA+0rrH2oHOmj6vKZp/kHl0KqFzA== X-Received: by 2002:a17:90a:d105:: with SMTP id l5mr13471254pju.17.1605926492123; Fri, 20 Nov 2020 18:41:32 -0800 (PST) Received: from [192.168.1.134] ([66.219.217.173]) by smtp.gmail.com with ESMTPSA id p127sm5216086pfp.93.2020.11.20.18.41.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 20 Nov 2020 18:41:31 -0800 (PST) Subject: Re: [GIT PULL] io_uring fixes for 5.10-rc To: Linus Torvalds , Al Viro Cc: io-uring , "linux-kernel@vger.kernel.org" References: <6535286b-2532-dc86-3c6e-1b1e9bce358f@kernel.dk> <4bcf3012-a4ad-ac2d-e70b-17f17441eea9@kernel.dk> From: Jens Axboe Message-ID: Date: Fri, 20 Nov 2020 19:41:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/20/20 5:23 PM, Linus Torvalds wrote: > On Fri, Nov 20, 2020 at 1:36 PM Jens Axboe wrote: >> >> I don't disagree with you on that. I've been a bit gun shy on touching >> the VFS side of things, but this one isn't too bad. I hacked up a patch >> that allows io_uring to do LOOKUP_RCU and a quick test seems to indicate >> it's fine. On top of that, we just propagate the error if we do fail and >> get rid of that odd retry loop. > > Ok, this looks better to me (but is obviously not 5.10 material). > > That said, I think I'd prefer to keep 'struct nameidata' internal to > just fs/namei.c, and maybe we can just expert that > > struct nameidata nd; > > set_nameidata(&nd, req->open.dfd, req->open.filename); > file = path_openat(&nd, &op, op.lookup_flags | LOOKUP_RCU); > restore_nameidata(); > return filp == ERR_PTR(-ECHILD) ? -EAGAIN : filp; > > as a helper from namei.c instead? Call it "do_filp_open_rcu()" or something? Yes, that's probably a better idea. I'll move in that direction. > That "force_nonblock" test seems a bit off, though. Why is that RCU > case only done when "!force_nonblock"? It would seem that if > force_nonblock is set, you want to do this too? Taking a second look at it, it's inverted. So if force_nonblock == true, we want to do just the RCU lookup. But I think the bit that you're missing is that the other case will do the normal lookup, which does an RCU lookup first. It looks needs to look like this: if (force_nonblock) file = do_filp_open_rcu(); else file = do_filp_open(); -- Jens Axboe