Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp871809ybh; Thu, 12 Mar 2020 12:38:50 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsPOWy7FKjPVx3sEpAgBMSgxju1qFr/or2H8JvSBDSJjcMHQhJ632QKhcnU5uyZecmWgY5z X-Received: by 2002:a9d:64d8:: with SMTP id n24mr7197694otl.71.1584041930593; Thu, 12 Mar 2020 12:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584041930; cv=none; d=google.com; s=arc-20160816; b=lPLz+yHMRXgXbxOq6XGE+Hf6fKrsTskg3tnXpGdnS+ndxRjuL9SeXrE45a9PB/0kEf 9CZeCY0AQPAoe0NVH8C74XmdSAGknLM4iPrfEu8NTa8IyMbgj2K85ADw1oi7Vs13AKFr 8df0fmfmRxBA2QV0zQmDq8/pXgzPOtKSU6ecJ1i/1KUOlU8QpnBDe0McVmTK29AFFlfc YxVpIEq//8ZeB+yBO23szdNas0gczVAlU4tXhW2QY0t9KbPp8ZM2k3n8WhLvj/siXJUs WE6/Hf8fKm7zYYboANoB3gM64qwjOBHvvjqEp1V+xc3Vtu8GOjI8id1tL2ySAxxbPMCs IwSg== 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=sxcixM7r92QuJby4u2ia65qn3VADu0fVk7xErC7ZO20=; b=bfmdusGqk+B0H/2xGPWRPg17KN9vD722tnysTaEE4ieymMpCygDdcwQIAksRkyVxPU opFomUz/e1mTVSfUobPWb14ghS2UCsjmJ8qEFHkJ/XNn8aLItrcnyuV8H0ONsaXZS2py m2Cc5B7GLRZIhaOWuqYSumTR15tl1MmPXFB7jqN6FENQfXcZuzLGosJZkq/fqmst4GW1 3DJQgvH3TqUwynGP0UG4A8VPW8NVnrN9htq1B0nK6MdaGrNGoo0oY8bYOHyLOtvZbYVo Q3IzCczRD7dYHgD6uZJ4zq/+kK/UwNmvx3ukf5QbMhBa+7qWUiDAROxebsxXE/Zt8y3q O8Mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o63si414613oih.74.2020.03.12.12.38.38; Thu, 12 Mar 2020 12:38:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726736AbgCLTiX (ORCPT + 99 others); Thu, 12 Mar 2020 15:38:23 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:56666 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726483AbgCLTiX (ORCPT ); Thu, 12 Mar 2020 15:38:23 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jCTeV-00AJDj-Tq; Thu, 12 Mar 2020 19:37:55 +0000 Date: Thu, 12 Mar 2020 19:37:55 +0000 From: Al Viro To: Stefan Metzmacher Cc: Linus Torvalds , David Howells , Aleksa Sarai , Ian Kent , Miklos Szeredi , Christian Brauner , Jann Horn , "Darrick J. Wong" , Karel Zak , jlayton@redhat.com, Linux API , linux-fsdevel , LSM List , Linux Kernel Mailing List , Jeremy Allison , Ralph =?iso-8859-1?Q?B=F6hme?= , Volker Lendecke Subject: Re: [PATCH 01/14] VFS: Add additional RESOLVE_* flags [ver #18] Message-ID: <20200312193755.GL23230@ZenIV.linux.org.uk> References: <158376244589.344135.12925590041630631412.stgit@warthog.procyon.org.uk> <158376245699.344135.7522994074747336376.stgit@warthog.procyon.org.uk> <20200310005549.adrn3yf4mbljc5f6@yavin> <580352.1583825105@warthog.procyon.org.uk> <3d209e29-e73d-23a6-5c6f-0267b1e669b6@samba.org> <8d24e9f6-8e90-96bb-6e98-035127af0327@samba.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d24e9f6-8e90-96bb-6e98-035127af0327@samba.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 12, 2020 at 06:11:09PM +0100, Stefan Metzmacher wrote: > If that works safely for hardlinks and having another process doing a > rename between openat2() and unlinkat(), we could try that. > > My initial naive idea was to have one syscall instead of > linkat2/renameat3/unlinkat2. > > int xlinkat(int src_dfd, const char *src_path, > int dst_dfd, const char *dst_path, > const struct xlinkat_how *how, size_t how_size); > > struct xlinkat_how { > __u64 src_at_flags; > __u64 src_resolve_flags; > __u64 dst_at_flags; > __u64 dst_resolve_flags; > __u64 rename_flags; > __s32 src_fd; > }; > > With src_dfd=-1, src_path=NULL, how.src_fd = -1, this would be like > linkat(). > With dst_dfd=-1, dst_path=NULL, it would be like unlinkat(). > Otherwise a renameat2(). > > If how.src_fd is not -1, it would be checked to be the same path as > specified by src_dfd and src_path. "Checked" as in...? And is that the same path or another link to the same object, or...? The idea of dumping all 3 into the same syscall looks wrong - compare the effects of link() and rename() on the opened files, for starters, and try to come up with documentation for all of that. Multiplexors tend to be very bad, in large part because they have so bloody convoluted semantics...