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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 D0BF9C33CB1 for ; Fri, 17 Jan 2020 15:47:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A440C2072E for ; Fri, 17 Jan 2020 15:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729196AbgAQPrI (ORCPT ); Fri, 17 Jan 2020 10:47:08 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:34442 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728816AbgAQPrI (ORCPT ); Fri, 17 Jan 2020 10:47:08 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1isTpp-00AKy8-Aa; Fri, 17 Jan 2020 15:46:57 +0000 Date: Fri, 17 Jan 2020 15:46:57 +0000 From: Al Viro To: Trond Myklebust Cc: "osandov@osandov.com" , "amir73il@gmail.com" , "dhowells@redhat.com" , "lsf-pc@lists.linux-foundation.org" , "hch@lst.de" , "miklos@szeredi.hu" , "linux-fsdevel@vger.kernel.org" Subject: Re: [LSF/MM/BPF TOPIC] Allowing linkat() to replace the destination Message-ID: <20200117154657.GK8904@ZenIV.linux.org.uk> References: <364531.1579265357@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Fri, Jan 17, 2020 at 02:33:01PM +0000, Trond Myklebust wrote: > On Fri, 2020-01-17 at 12:49 +0000, David Howells wrote: > > It may be worth a discussion of whether linkat() could be given a > > flag to > > allow the destination to be replaced or if a new syscall should be > > made for > > this - or whether it should be disallowed entirely. > > > > A set of patches has been posted by Omar Sandoval that makes this > > possible: > > > > > > https://lore.kernel.org/linux-fsdevel/cover.1524549513.git.osandov@fb.com/ > > > > though it only includes filesystem support for btrfs. > > > > This could be useful for cachefiles: > > > > > > https://lore.kernel.org/linux-fsdevel/3326.1579019665@warthog.procyon.org.uk/ > > > > and overlayfs. > > > > That seems to me like a "just go ahead and do it if you can justify it" > kind of thing. It has plenty of precedent, and fits easily into the > existing syscall, so why do we need a face-to-face discussion? Unfortunately, it does *not* fit easily. And IMO that's linux-abi fodder more than anything else. The problem is in coming up with sane semantics - there's a plenty of corner cases with that one. What to do when destination is a dangling symlink, for example? Or has something mounted on it (no, saying "we'll just reject directories" is not enough). What should happen when destination is already a hardlink to the same object? It's less of a horror than rename() would've been, but that's not saying much.