From: Amir Goldstein <amir73il@gmail.com>
To: Christian Brauner <brauner@kernel.org>, Jeff Layton <jlayton@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>,
Christoph Hellwig <hch@lst.de>, Jan Kara <jack@suse.cz>,
David Howells <dhowells@redhat.com>, Jens Axboe <axboe@kernel.dk>,
Miklos Szeredi <miklos@szeredi.hu>,
Al Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org
Subject: [PATCH 0/2] Avert possible deadlock with splice() and fanotify
Date: Wed, 29 Nov 2023 22:07:07 +0200 [thread overview]
Message-ID: <20231129200709.3154370-1-amir73il@gmail.com> (raw)
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
next reply other threads:[~2023-11-29 20:07 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 20:07 Amir Goldstein [this message]
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
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=20231129200709.3154370-1-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=dhowells@redhat.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--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).