From: Bernd Schubert <aakef@fastmail.fm>
To: Miklos Szeredi <miklos@szeredi.hu>, Bernd Schubert <bschubert@ddn.com>
Cc: linux-fsdevel@vger.kernel.org, bernd.schubert@fastmail.fm,
dsingh@ddn.com, Hao Xu <howeyxu@tencent.com>
Subject: Re: [PATCH 3/6] fuse: Allow parallel direct writes for O_DIRECT
Date: Wed, 30 Aug 2023 16:38:03 +0200 [thread overview]
Message-ID: <77a8edad-0a26-aed5-2ee3-956a96a034de@fastmail.fm> (raw)
In-Reply-To: <CAJfpegsGLTiWvjfoZs9fAQ0xWK-QBwtAXe5_Msr_jiY4Rjssxg@mail.gmail.com>
On 8/30/23 15:28, Miklos Szeredi wrote:
> On Tue, 29 Aug 2023 at 18:11, Bernd Schubert <bschubert@ddn.com> wrote:
>>
>> Take a shared lock in fuse_cache_write_iter. This was already
>> done for FOPEN_DIRECT_IO in
>>
>> commit 153524053bbb ("fuse: allow non-extending parallel direct
>> writes on the same file")
>>
>> but so far missing for plain O_DIRECT. Server side needs
>> to set FOPEN_PARALLEL_DIRECT_WRITES in order to signal that
>> it supports parallel dio writes.
>
> Hmm, I think file_remove_privs() needs exclusive lock (due to calling
> notify_change()). And the fallback case also.
>
> Need to be careful with such locking changes...
Hrmm, yeah, I missed that :( Really sorry and thanks!
I guess I can fix it if by exporting dentry_needs_remove_privs. I hope
that is acceptable. Interesting is that btrfs_direct_write seems to have
the same issue.
btrfs_direct_write
if (iocb->ki_pos + iov_iter_count(from) <= i_size_read(inode))
ilock_flags |= BTRFS_ILOCK_SHARED;
...
err = btrfs_inode_lock(BTRFS_I(inode), ilock_flags);
...
err = btrfs_write_check(iocb, from, err);
...
ret = file_remove_privs(file);
I think that can be fixed as well after exporting
dentry_needs_remove_privs().
Btw, why is fuse_direct_write_iter not dropping privileges? That is
another change I need to document...
Another issue I just see is that it needs to check file size again after
taking the lock.
Thanks a lot for your review,
Bernd
next prev parent reply other threads:[~2023-08-30 18:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-29 16:11 [PATCH 0/5 v3] fuse direct write consolidation and parallel IO Bernd Schubert
2023-08-29 16:11 ` [PATCH 1/6] fuse: direct IO can use the write-through code path Bernd Schubert
2023-08-29 16:11 ` [PATCH 2/6] fuse: Create helper function if DIO write needs exclusive lock Bernd Schubert
2023-08-30 10:57 ` Miklos Szeredi
2023-08-30 12:13 ` Bernd Schubert
2023-08-30 12:14 ` Miklos Szeredi
2023-08-29 16:11 ` [PATCH 3/6] fuse: Allow parallel direct writes for O_DIRECT Bernd Schubert
2023-08-30 13:28 ` Miklos Szeredi
2023-08-30 14:38 ` Bernd Schubert [this message]
2023-08-30 14:50 ` Miklos Szeredi
2023-08-31 8:30 ` Hao Xu
2023-08-31 8:33 ` Bernd Schubert
2023-08-29 16:11 ` [PATCH 4/6] fuse: Rename fuse_direct_io Bernd Schubert
2023-08-29 16:11 ` [PATCH 5/6] fuse: Remove fuse_direct_write_iter code path / use IOCB_DIRECT Bernd Schubert
2023-08-31 9:19 ` Hao Xu
2023-08-31 9:34 ` Bernd Schubert
2023-09-01 2:54 ` Hao Xu
2023-08-29 16:11 ` [PATCH 6/6] fuse: Remove page flush/invaliation in fuse_direct_io 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=77a8edad-0a26-aed5-2ee3-956a96a034de@fastmail.fm \
--to=aakef@fastmail.fm \
--cc=bernd.schubert@fastmail.fm \
--cc=bschubert@ddn.com \
--cc=dsingh@ddn.com \
--cc=howeyxu@tencent.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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 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.