All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Avert possible deadlock with splice() and fanotify
@ 2023-11-29 20:07 Amir Goldstein
  2023-11-29 20:07 ` [PATCH 1/2] fs: fork do_splice_copy_file_range() from do_splice_direct() Amir Goldstein
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Amir Goldstein @ 2023-11-29 20:07 UTC (permalink / raw)
  To: Christian Brauner, Jeff Layton
  Cc: Josef Bacik, Christoph Hellwig, Jan Kara, David Howells,
	Jens Axboe, Miklos Szeredi, Al Viro, linux-fsdevel

Christian,

Josef has helped me see the light and figure out how to avoid the
possible deadlock, which involves:
- splice() from source file in a loop mounted fs to dest file in
  a host fs, where the loop image file is
- fsfreeze on host fs
- write to host fs in context of fanotify permission event handler
  (FAN_ACCESS_PERM) on the splice source file

The first patch should not be changing any logic.
I only build tested the ceph patch, so hoping to get an
Acked-by/Tested-by from Jeff.

The second patch rids us of the deadlock by not holding
file_start_write() while reading from splice source file.

The patches apply and tested on top of vfs.rw branch.

Thanks,
Amir.

Amir Goldstein (2):
  fs: fork do_splice_copy_file_range() from do_splice_direct()
  fs: move file_start_write() into direct_splice_actor()

 fs/ceph/file.c         |  9 +++--
 fs/overlayfs/copy_up.c |  2 -
 fs/read_write.c        |  8 +---
 fs/splice.c            | 88 +++++++++++++++++++++++++++++++-----------
 include/linux/fs.h     |  2 -
 include/linux/splice.h | 13 ++++---
 6 files changed, 81 insertions(+), 41 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2023-11-30 13:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-29 20:07 [PATCH 0/2] Avert possible deadlock with splice() and fanotify Amir Goldstein
2023-11-29 20:07 ` [PATCH 1/2] fs: fork do_splice_copy_file_range() from do_splice_direct() Amir Goldstein
2023-11-30 10:09   ` Amir Goldstein
2023-11-30 13:30     ` Jan Kara
2023-11-30 13:18   ` Christian Brauner
2023-11-30 13:37     ` Amir Goldstein
2023-11-29 20:07 ` [PATCH 2/2] fs: move file_start_write() into direct_splice_actor() Amir Goldstein
2023-11-30 13:32   ` Jan Kara
2023-11-30  8:32 ` [PATCH 0/2] Avert possible deadlock with splice() and fanotify Amir Goldstein
2023-11-30 10:07   ` Amir Goldstein
2023-11-30 13:37     ` Jan Kara
2023-11-30 13:46       ` Amir Goldstein

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.