linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [LSF/MM/BPF TOPIC] making O_TMPFILE more atomic
@ 2022-02-24  5:30 Steve French
  2022-05-03 18:52 ` Miklos Szeredi
  0 siblings, 1 reply; 3+ messages in thread
From: Steve French @ 2022-02-24  5:30 UTC (permalink / raw)
  To: lsf-pc, linux-fsdevel; +Cc: LKML

Currently creating tmpfiles on Linux can be problematic because the
tmpfile is not created and opened at the same time  (vfs_tmpfile calls
into the fs, then later vfs_open is called to open the tmpfile).   For
some filesystems it would be more natural to create and open the
tmpfile as one operation (because the action of creating the file on
some filesystems returns an open handle, so closing it then reopening
it would cause the tmpfile to be deleted).

I would like to discuss whether the function do_tmpfile (which creates
and then opens the tmpfile) could have an option for a filesystem to
do this as one operation which would allow it to be more atomic and
allow it to work on a wider variety of filesystems.

-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LSF/MM/BPF TOPIC] making O_TMPFILE more atomic
  2022-02-24  5:30 [LSF/MM/BPF TOPIC] making O_TMPFILE more atomic Steve French
@ 2022-05-03 18:52 ` Miklos Szeredi
  2022-05-09 15:47   ` Chuck Lever III
  0 siblings, 1 reply; 3+ messages in thread
From: Miklos Szeredi @ 2022-05-03 18:52 UTC (permalink / raw)
  To: Steve French; +Cc: lsf-pc, linux-fsdevel, LKML

On Thu, 24 Feb 2022 at 06:33, Steve French <smfrench@gmail.com> wrote:
>
> Currently creating tmpfiles on Linux can be problematic because the
> tmpfile is not created and opened at the same time  (vfs_tmpfile calls
> into the fs, then later vfs_open is called to open the tmpfile).   For
> some filesystems it would be more natural to create and open the
> tmpfile as one operation (because the action of creating the file on
> some filesystems returns an open handle, so closing it then reopening
> it would cause the tmpfile to be deleted).
>
> I would like to discuss whether the function do_tmpfile (which creates
> and then opens the tmpfile) could have an option for a filesystem to
> do this as one operation which would allow it to be more atomic and
> allow it to work on a wider variety of filesystems.

A related thread:

https://lore.kernel.org/all/20201109100343.3958378-3-chirantan@chromium.org/#r

There was no conclusion in the end. Not sure how hacky it would be to
store the open file in the inode...

Thanks,
Miklos

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LSF/MM/BPF TOPIC] making O_TMPFILE more atomic
  2022-05-03 18:52 ` Miklos Szeredi
@ 2022-05-09 15:47   ` Chuck Lever III
  0 siblings, 0 replies; 3+ messages in thread
From: Chuck Lever III @ 2022-05-09 15:47 UTC (permalink / raw)
  To: Miklos Szeredi, Steve French; +Cc: lsf-pc, linux-fsdevel, LKML



> On May 3, 2022, at 2:52 PM, Miklos Szeredi <miklos@szeredi.hu> wrote:
> 
> On Thu, 24 Feb 2022 at 06:33, Steve French <smfrench@gmail.com> wrote:
>> 
>> Currently creating tmpfiles on Linux can be problematic because the
>> tmpfile is not created and opened at the same time  (vfs_tmpfile calls
>> into the fs, then later vfs_open is called to open the tmpfile).   For
>> some filesystems it would be more natural to create and open the
>> tmpfile as one operation (because the action of creating the file on
>> some filesystems returns an open handle, so closing it then reopening
>> it would cause the tmpfile to be deleted).
>> 
>> I would like to discuss whether the function do_tmpfile (which creates
>> and then opens the tmpfile) could have an option for a filesystem to
>> do this as one operation which would allow it to be more atomic and
>> allow it to work on a wider variety of filesystems.
> 
> A related thread:
> 
> https://lore.kernel.org/all/20201109100343.3958378-3-chirantan@chromium.org/#r
> 
> There was no conclusion in the end. Not sure how hacky it would be to
> store the open file in the inode...

I just proposed adding a VFS API to make open/create atomic.
See 8/8 in this thread:

https://lore.kernel.org/linux-nfs/20220420192418.GB27805@fieldses.org/T/#m505a59ad4e4ed1413ffc055a088de3182fb50bb4

It adds a sibling API to dentry_open(). I didn't have
O_TMPFILE in mind when I created this API.


--
Chuck Lever




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-09 15:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24  5:30 [LSF/MM/BPF TOPIC] making O_TMPFILE more atomic Steve French
2022-05-03 18:52 ` Miklos Szeredi
2022-05-09 15:47   ` Chuck Lever III

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).