Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2116400pxb; Sat, 23 Jan 2021 18:04:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwc5VCNIPXU9wQ1myrKYRFTDAh//lPVjaqX+Keg/P/aBq+McEGyAdBZ6ebHZPBrdVe1y/6L X-Received: by 2002:a50:c3c5:: with SMTP id i5mr78592edf.166.1611453863424; Sat, 23 Jan 2021 18:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611453863; cv=none; d=google.com; s=arc-20160816; b=VWOmJwJToH9sj7WW93OMSfmK+16mVqa1zeS3ojxy23IQkaGIBERB2Eluxm7zHb6CDf 30M0yMQ0LaYdhFs0Oe255CI2xWYJjgEXqLWyZRtcbQ2pZJhfTt1dBQjerVV7/vzqEBL8 P8LjHO/p30rm4HxD866Em1wCdL4ERbq3pT7oSxB+u4FFcPdndEJuv6zBRZY9N5Exmolj YPOAeRfvGEUAM1KH/M4RYF0AbbiMUp/2tTeBDKGY7RgiAzNOGRnH0A0RyYPPjN4KwcZo DxFBzRHVY1EC3LOYO0Fk5a2A85eKenuy1JDIuUrlKBUwn0Y+kjmFjZghuokZTAoNFbua XgIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=DUtNstGk5XSlRraXlnlRBpixFf+jS4+6etXYytssUPM=; b=yssSjKMVTvnd3QCOsVSAty1qTx0KGbGVzRXpJkVL+8VfnIcM9UPngUF4umH+BMkVpS BPY9WyCd7kIpipYZ2jJQfKBN9eOJmptV9x6OZ/FyBJF6KBJ58SR2d2FfDQXsF9SRMJhd HAVbJHjE7wpSLcC6OnBbCmMJb8OhZMy+OuUEGc+JdOZ6+OK3YW1q08XyumnZaa1A3Jyc rjbkgSuEYOMwcOmLasdHXyWxnnJqj1x+5RBsRAg237BMuYXOuTk7Y8Qoe65D/29SvZAi zaZLolFBUhssuPnsoQK9NvORxoP/LJ99XFB6nDxDu3L2E/fTJgXR9U5QqpSZBolRrtXE zuig== ARC-Authentication-Results: i=1; mx.google.com; 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 kl4si1764011ejc.341.2021.01.23.18.03.33; Sat, 23 Jan 2021 18:04:23 -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; 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 S1726476AbhAXCAD (ORCPT + 99 others); Sat, 23 Jan 2021 21:00:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726288AbhAXCAC (ORCPT ); Sat, 23 Jan 2021 21:00:02 -0500 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F3D6C0613D6 for ; Sat, 23 Jan 2021 17:59:22 -0800 (PST) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1l3UgD-005Cgl-3r; Sun, 24 Jan 2021 01:59:05 +0000 Date: Sun, 24 Jan 2021 01:59:05 +0000 From: Al Viro To: Andres Freund Cc: Lennert Buytenhek , Jens Axboe , linux-kernel@vger.kernel.org, io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: Re: [RFC PATCH] io_uring: add support for IORING_OP_GETDENTS64 Message-ID: <20210124015905.GH740243@zeniv-ca> References: <20210123114152.GA120281@wantstofly.org> <20210123235055.azmz5jm2lwyujygc@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210123235055.azmz5jm2lwyujygc@alap3.anarazel.de> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 23, 2021 at 03:50:55PM -0800, Andres Freund wrote: > As there's only a shared lock, seems like both would end up with the > same ctx->pos and end up updating f_pos to the same offset (assuming the > same count). > > Am I missing something? This: f = fdget_pos(fd); if (!f.file) return -EBADF; in the callers. Protection of struct file contents belongs to struct file, *not* struct inode. Specifically, file->f_pos_lock. *IF* struct file in question happens to be shared and the file is a regular or directory (sockets don't need any exclusion on read(2), etc.)