[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200115083619.GA23039@lst.de>
Date: Wed, 15 Jan 2020 09:36:19 +0100
From: Christoph Hellwig <hch@....de>
To: David Howells <dhowells@...hat.com>
Cc: linux-fsdevel@...r.kernel.org, viro@...iv.linux.org.uk, hch@....de,
tytso@....edu, adilger.kernel@...ger.ca, darrick.wong@...cle.com,
clm@...com, josef@...icpanda.com, dsterba@...e.com,
linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: Making linkat() able to overwrite the target
On Tue, Jan 14, 2020 at 04:34:25PM +0000, David Howells wrote:
>
> when a file gets invalidated by the server - and, under some circumstances,
> modified locally - I have the cache create a temporary file with vfs_tmpfile()
> that I'd like to just link into place over the old one - but I can't because
> vfs_link() doesn't allow you to do that. Instead I have to either unlink the
> old one and then link the new one in or create it elsewhere and rename across.
>
> Would it be possible to make linkat() take a flag, say AT_LINK_REPLACE, that
> causes the target to be replaced and not give EEXIST? Or make it so that
> rename() can take a tmpfile as the source and replace the target with that. I
> presume that, either way, this would require journal changes on ext4, xfs and
> btrfs.
This sounds like a very useful primitive, and from the low-level XFS
point of view should be very easy to implement and will not require any
on-disk changes. I can't really think of any good userspace interface but
a new syscall, though.
Powered by blists - more mailing lists