From: Christoph Hellwig <hch@lst.de>
To: David Howells <dhowells@redhat.com>
Cc: linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk,
hch@lst.de, tytso@mit.edu, adilger.kernel@dilger.ca,
darrick.wong@oracle.com, clm@fb.com, josef@toxicpanda.com,
dsterba@suse.com, linux-ext4@vger.kernel.org,
linux-xfs@vger.kernel.org, linux-btrfs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: Making linkat() able to overwrite the target
Date: Wed, 15 Jan 2020 09:36:19 +0100 [thread overview]
Message-ID: <20200115083619.GA23039@lst.de> (raw)
In-Reply-To: <3326.1579019665@warthog.procyon.org.uk>
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.
prev parent reply other threads:[~2020-01-15 8:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 16:34 Making linkat() able to overwrite the target David Howells
2020-01-14 17:02 ` Al Viro
2020-01-14 18:06 ` David Howells
2020-01-14 19:37 ` Miklos Szeredi
2020-01-17 0:46 ` Colin Walters
2020-01-17 9:57 ` Amir Goldstein
2020-01-17 11:42 ` David Howells
2020-01-17 16:22 ` Omar Sandoval
2020-01-17 16:39 ` David Howells
2020-01-15 8:36 ` Christoph Hellwig [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200115083619.GA23039@lst.de \
--to=hch@lst.de \
--cc=adilger.kernel@dilger.ca \
--cc=clm@fb.com \
--cc=darrick.wong@oracle.com \
--cc=dhowells@redhat.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).