From: Bernd Schubert <bschubert@ddn.com>
To: linux-fsdevel@vger.kernel.org
Cc: bernd.schubert@fastmail.fm, fuse-devel@lists.sourceforge.net,
Bernd Schubert <bschubert@ddn.com>,
Miklos Szeredi <miklos@szeredi.hu>,
Vivek Goyal <vgoyal@redhat.com>,
Christian Brauner <brauner@kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Dharmendra Singh <dsingh@ddn.com>,
Horst Birthelmer <hbirthelmer@ddn.com>
Subject: [PATCH v8 0/6] fuse: full atomic open and atomic-open-revalidate
Date: Wed, 16 Aug 2023 16:33:07 +0200 [thread overview]
Message-ID: <20230816143313.2591328-1-bschubert@ddn.com> (raw)
In FUSE, as of now, uncached lookups are expensive over the wire.
E.g additional latencies and stressing (meta data) servers from
thousands of clients. With atomic-open lookup before open
can be avoided.
Here is the link to performance numbers
https://lore.kernel.org/linux-fsdevel/20220322121212.5087-1-dharamhans87@gmail.com/
Here is the libfuse pull request
https://github.com/libfuse/libfuse/pull/813
The patches are passing passthrough_hp xfstests (libfuse part applied),
although we had to introduce umount retries into xfstests, as recent
kernels/xfstests fail umount in some tests with
EBUSY - independent of atomic open. (Although outstanding for v7)
I'm especially interested in Al's and Christians opinion about the
atomic open dentry revalidation in v7. If the vfs changes are
acceptable, would it be possible to also look at the other patches
and their vfs/dcache interaction? I __hope__ I got it right and I hope
the vfs can be accepted.
v8: - Another slight indentation fix in _fuse_atomic_open
- Fix compilation error in patch 4 (fuse atomic revalidate)
- Remove LOOKUP_ATOMIC_REVALIDATE
- Switch from DCACHE_ATOMIC_OPEN flag to return value and
and introduce an enum for d_revalidate return values.
- checkpatch fixes
v7: - Indentation and style fixes for _fuse_atomic_open.
- Remodel atomic open to avoid races with parallel lookup, similar
to NFS commit c94c09535c4debcc439f55b5b6d9ebe57bd4665a and what
is done in _nfs4_open_and_get_state()
A WARN_ONCE() and fallback is added to ensure operation is on
negative dentries only.
- Error handling is done via the fallback fuse_create_open()
to reduce complexity and code duplication.
- Remove entry cache invalidation on ENOENT in the atomic-open
patch, as atomic-open so far operates on negative dentries only.
- Remove fuse_advise_use_readdirplus() in _fuse_atomic_open
(Thanks Miklos)
- Add forgotten free_ext_value() (Thanks Miklos).
- Declare struct fuse_inode per condition as the value needs to
be retrieved anyway per condition.
- Added atomic open-revalidation and required vfs changes
- Added myself (Bernd) as Co-developed-by to Dharmendras patches, as
I did substantial modifications.
- More as reminder for myself, so far these tests below are
done manually or with custom scripts, I think we need xfstests
for these.
With updated libfuse /scratch/dest is mounted by:
passthrough_hp -o allow_other --foreground --debug-fuse /scratch/source /scratch/dest
1) Test atomic open (file create) and negative dentry open
rm -f /scratch/source/file # ensure file does not exist
mount /scratch/dest # overlay of /scratch source
echo a > /scratch/dest/file # non-existing file
umount and mount /scratch/test (clear cache)
cat /scratch/dest/file
rm -f /scratch/dest/file
2) Test dir open
mkdir /scratch/source/dir
mount /scratch/dest # overlay of /scratch source
cat /scratch/source/dir
rmdir /scratch/source/dir
3) Test revalidate without file change
mount /scratch/dest
echo "a" > /scratch/dest/file
echo "b" >> /scratch/dest/file
echo "c" >> /scratch/dest/file
cat /scratch/dest/file
rm -f /scratch/dest/file
4) Test revalidate by underlying file change
mount /scratch/dest
echo "a" > /scratch/dest/file
cat /scratch/dest/file
rm -f /scratch/source/file # unknown to dest mount
str="b"
echo "${str}" > /scratch/source/file
reval=$(cat /scratch/dest/file)
if [ "$str" != "reval" ]; then
echo "String mismatch after revalidation"
exit 1
fi
rm -f /scratch/dest/file
5) Test revalidate by underlying file change, but with
O_CREATE included. Tests dentry creation by the atomic
revalidate
mount /scratch/dest
echo "a" >> /scratch/dest/file
rm -f /scratch/source/file
echo "b" > /scratch/source/file
# revalidate includes O_CREATE
echo "c" >> /scratch/dest/file
6) Repeat above tests, but with additional "--nocache"
passthrough_hp option
v6: Addressed Miklos comments and rewrote atomic open into its own
function. Also dropped for now is the revalidate optimization, we
have the code/patch, but it needs more testing. Also easier to
first agree on atomic open and then to land the next optimization.
v5: Addressed comments
v3: Addressed comments
v4: Addressed all comments and refactored the code into 3 separate patches
respectively for Atomic create, Atomic open, optimizing lookup in
d_revalidate().
v3: handle review comments
v2: fixed a memory leak in <fuse_atomic_open_common>
Bernd Schubert (5):
fuse: rename fuse_create_open
fuse: introduce atomic open
fuse: Revalidate positive entries in fuse_atomic_open
fuse: revalidate Set DCACHE_ATOMIC_OPEN for cached dentries
fuse: Avoid code duplication in atomic open
Miklos Szeredi (1):
[RFC] Allow atomic_open() on positive dentry
fs/fuse/dir.c | 398 +++++++++++++++++++++++++++++++++++++-
fs/fuse/fuse_i.h | 6 +
fs/namei.c | 17 +-
include/linux/dcache.h | 6 +
include/linux/namei.h | 1 +
include/uapi/linux/fuse.h | 3 +
6 files changed, 422 insertions(+), 9 deletions(-)
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Dharmendra Singh <dsingh@ddn.com>
Cc: Horst Birthelmer <hbirthelmer@ddn.com>
Cc: linux-fsdevel@vger.kernel.org
--
2.34.1
next reply other threads:[~2023-08-16 14:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-16 14:33 Bernd Schubert [this message]
2023-08-16 14:33 ` [PATCH 1/6] fuse: rename fuse_create_open Bernd Schubert
2023-08-16 14:33 ` [PATCH 2/6] fuse: introduce atomic open Bernd Schubert
2023-08-16 14:33 ` [PATCH 3/6] [RFC] Allow atomic_open() on positive dentry Bernd Schubert
2023-08-16 15:25 ` Miklos Szeredi
2023-08-16 15:54 ` Bernd Schubert
2023-08-16 14:33 ` [PATCH 4/6] fuse: Revalidate positive entries in fuse_atomic_open Bernd Schubert
2023-08-16 14:33 ` [PATCH 5/6] fuse: revalidate Set DCACHE_ATOMIC_OPEN for cached dentries Bernd Schubert
2023-08-16 14:33 ` [PATCH 6/6] fuse: Avoid code duplication in atomic open Bernd Schubert
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=20230816143313.2591328-1-bschubert@ddn.com \
--to=bschubert@ddn.com \
--cc=bernd.schubert@fastmail.fm \
--cc=brauner@kernel.org \
--cc=dsingh@ddn.com \
--cc=fuse-devel@lists.sourceforge.net \
--cc=hbirthelmer@ddn.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=vgoyal@redhat.com \
--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).