From: Goldwyn Rodrigues <rgoldwyn@suse.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Cc: "fdmanana@gmail.com" <fdmanana@gmail.com>,
David Sterba <dsterba@suse.com>,
"linux-btrfs @ vger . kernel . org" <linux-btrfs@vger.kernel.org>,
Josef Bacik <josef@toxicpanda.com>
Subject: Re: [RFC PATCH] btrfs: don't call btrfs_sync_file from iomap context
Date: Tue, 1 Sep 2020 13:40:40 -0500 [thread overview]
Message-ID: <20200901184040.gxa3bh3nvrddi7ai@fiona> (raw)
In-Reply-To: <SN4PR0401MB3598F35FDA34EF5DE377C2CE9B2E0@SN4PR0401MB3598.namprd04.prod.outlook.com>
On 14:44 01/09, Johannes Thumshirn wrote:
> On 01/09/2020 16:37, Filipe Manana wrote:
> >> + iocb->ki_flags |= IOCB_DSYNC;
> >
> > This should be set before calling generic_write_sync() above,
> > otherwise we don't do the persistence required by dsync.
> >
> > I have to be honest, I don't like this approach that much, it's a bit
> > fragile - what if some other code, invoked in between clearing and
> > setting back the flag, needs that flag to operate correctly?
>
> Yes I don't like it either.
>
> I've compared btrfs to ext4 and xfs and both don't hold on the inode
> lock for (nearly) the whole xxx_file_write_iter() time, so I think
> the correct fix would be to relax this time. But I haven't found any
> documentation yet on which functions need to be under the inode_lock
> and which not.
I think you have got this reversed. ext4 and xfs hold the inode lock for
the entire xxx_file_write_iter(). OTOH, they don't take the inode lock
during fsync operations. The comments in btrfs_sync_file() mention that
it needs to make sure inode lock is acquired to make sure no other
process dirty the pages while sync is running.
>
> Any input is appreciated here.
>
--
Goldwyn
next prev parent reply other threads:[~2020-09-01 18:40 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 13:06 [RFC PATCH] btrfs: don't call btrfs_sync_file from iomap context Johannes Thumshirn
2020-09-01 13:11 ` Johannes Thumshirn
2020-09-01 14:17 ` Goldwyn Rodrigues
2020-09-01 14:20 ` Johannes Thumshirn
2020-09-01 14:37 ` Filipe Manana
2020-09-01 14:44 ` Johannes Thumshirn
2020-09-01 18:40 ` Goldwyn Rodrigues [this message]
2020-09-01 15:11 ` Josef Bacik
2020-09-01 17:45 ` Darrick J. Wong
2020-09-01 17:55 ` Josef Bacik
2020-09-01 21:46 ` Dave Chinner
2020-09-01 22:19 ` Josef Bacik
2020-09-01 23:58 ` Dave Chinner
2020-09-02 0:22 ` Josef Bacik
2020-09-02 7:12 ` Johannes Thumshirn
2020-09-02 11:10 ` Josef Bacik
2020-09-02 16:29 ` Darrick J. Wong
2020-09-02 16:47 ` Josef Bacik
2020-09-02 11:44 ` Matthew Wilcox
2020-09-02 12:20 ` Dave Chinner
2020-09-02 12:42 ` Josef Bacik
2020-09-03 2:28 ` Dave Chinner
2020-09-03 9:49 ` Filipe Manana
2020-09-03 16:32 ` Christoph Hellwig
2020-09-03 16:46 ` Josef Bacik
2020-09-07 0:04 ` Dave Chinner
2020-09-15 21:48 ` Goldwyn Rodrigues
2020-09-17 3:09 ` Dave Chinner
2020-09-17 5:52 ` Christoph Hellwig
2020-09-17 6:29 ` Dave Chinner
2020-09-17 6:42 ` Christoph Hellwig
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=20200901184040.gxa3bh3nvrddi7ai@fiona \
--to=rgoldwyn@suse.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=dsterba@suse.com \
--cc=fdmanana@gmail.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
/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).