From: NeilBrown <neilb@suse.com>
To: "Yan, Zheng" <ukernel@gmail.com>
Cc: "Yan, Zheng" <zyan@redhat.com>, Sage Weil <sage@redhat.com>,
Ilya Dryomov <idryomov@gmail.com>,
ceph-devel <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH 0/2]: CEPHFS: allow for races between direct and buffered writes
Date: Thu, 01 Sep 2016 11:13:36 +1000 [thread overview]
Message-ID: <87mvjscthb.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <CAAM7YA=p9EdH6Kd2t_b5ZzbEHm5PSvEVakcSTtCiH=5o5sNi1g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]
On Wed, Aug 31 2016, Yan, Zheng wrote:
> On Wed, Aug 31, 2016 at 10:56 AM, NeilBrown <neilb@suse.com> wrote:
>>
>> Hi,
>> it is quite possible for O_DIRECT and buffered writes to a file to
>> race.
>> The xfstests test suite has a test - generic/036 - which tests this
>> case.
>>
>> Unlike most filesystems, cephfs does not hold inode_lock() across
>> direct writes. This means that buffer pages can become dirty while
>> direct writes are happening. This confused ceph a little.
>
> how about make ceph_write_iter() hold inode_lock() for direct/sync write?
You could probably do that. You could even use inode_lock_shared() to
allow multiple writers to perform O_DIRECT writes to the same file in
parallel.
But I don't know why ceph did this differently from every other
filesystem, and the git commit message doesn't shine any light on that
question. I didn't want to propose a change that I didn't understand
the consequences of.
If you did extend the locking over ceph_direct_read_write(), it would
probably make sense to remove the truncate_inode_pages_range() call as
it should be redundant.
Thanks,
NeilBrown
>
> Regards
> Yan, Zheng
>>
>> The following two patches allow ceph to handle this possibility a
>> little more cleanly. The more important patch removes a WARN_ON() for
>> a circumstance which can easily be triggered.
>>
>> Thanks,
>> NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
next prev parent reply other threads:[~2016-09-01 1:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-31 2:56 [PATCH 0/2]: CEPHFS: allow for races between direct and buffered writes NeilBrown
2016-08-31 2:58 ` [PATCH 1/2] cephfs: ignore error from invalidate_inode_pages2_range() in direct write NeilBrown
2016-08-31 13:47 ` Jeff Layton
2016-09-01 1:01 ` NeilBrown
2016-08-31 2:59 ` [PATCH 2/2] cephfs: remove warning when ceph_releasepage() is called on dirty page NeilBrown
2016-08-31 13:48 ` Jeff Layton
2016-08-31 9:19 ` [PATCH 0/2]: CEPHFS: allow for races between direct and buffered writes Yan, Zheng
2016-09-01 1:13 ` NeilBrown [this message]
2016-09-01 14:30 ` Yan, Zheng
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=87mvjscthb.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=sage@redhat.com \
--cc=ukernel@gmail.com \
--cc=zyan@redhat.com \
/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).