From: Theodore Ts'o <tytso@mit.edu>
To: Lucas Nussbaum <lucas.nussbaum@loria.fr>
Cc: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Emmanuel Jeanvoine <emmanuel.jeanvoine@inria.fr>
Subject: Re: [PATCH, RFC] fs: only call sync_filesystem() when remounting read-only
Date: Mon, 10 Mar 2014 10:41:28 -0400 [thread overview]
Message-ID: <20140310144128.GC10562@thunk.org> (raw)
In-Reply-To: <20140310114508.GA28107@xanadu.blop.info>
On Mon, Mar 10, 2014 at 12:45:08PM +0100, Lucas Nussbaum wrote:
> > Lukas, can you try this patch? I'm pretty sure this is what's going
> > on. It turns out each "mount -o remount" is implying an fsync(), so
> > your test case is identical to copying a large file while having
> > thousand of processes calling syncfs() on the file system, with the
> > predictable results.
>
> Hi Ted,
>
> I can confirm that:
> 1) the patch solves my problem
> 2) issuing 'sync' instead of 'mount -o remount' indeed exhibits the
> problem again
>
> However, I'm curious: why would such a workload (multiple syncfs()
> initiated during a write) block for several minutes on an ext4
> filesystem? I've just tried again on ext3, and it's not a problem in
> that case.
The reason why is because ext3 is less careful than ext4.
ext3_sync_fs() simply tries to start a commit, and if there is already
a commit already started, it does nothing. So if you issue a
gazillion syncfs() calls, with ext3, it's a no-op.
For ext4, each syncfs() call will result in a SYNC_CACHE flushh being
sent to the disk:
/*
* Data writeback is possible w/o journal transaction, so barrier must
* being sent at the end of the function. But we can skip it if
* transaction_commit will do it for us.
*/
target = jbd2_get_latest_transaction(sbi->s_journal);
if (wait && sbi->s_journal->j_flags & JBD2_BARRIER &&
!jbd2_trans_will_send_data_barrier(sbi->s_journal, target))
needs_barrier = true;
.
.
.
if (needs_barrier) {
int err;
err = blkdev_issue_flush(sb->s_bdev, GFP_KERNEL, NULL);
if (!ret)
ret = err;
}
We can debate whether or not this care is necessary, and since
syncfs() isn't terribly reliable, we could add hacks so that if an
syncfs() had been issued in the last 100ms, we could make it be a
no-op, or some other horrible hack.
But given that these hacks are horrible, it's not clear that it's
worth it to do all of this just to something where userspace is doing
something really stupid, whether it is issuing thousands of syncfs()
or "mount -o remount" requests per second.
Cheers,
- Ted
next prev parent reply other threads:[~2014-03-10 14:41 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 14:13 Extremely slow remounts with concurrent I/O Lucas Nussbaum
2014-03-06 13:56 ` [PATCH, RFC] jbd2: don't write non-commit blocks synchronously Theodore Ts'o
2014-03-06 17:28 ` Lucas Nussbaum
2014-03-06 18:27 ` Theodore Ts'o
2014-03-06 18:45 ` Lucas Nussbaum
2014-03-06 18:37 ` Lucas Nussbaum
2014-03-08 16:08 ` [PATCH, RFC] fs: only call sync_filesystem() when remounting read-only Theodore Ts'o
2014-03-10 11:45 ` Lucas Nussbaum
2014-03-10 14:41 ` Theodore Ts'o [this message]
2014-03-10 12:15 ` Lucas Nussbaum
2014-03-13 0:36 ` Dave Chinner
2014-03-13 1:16 ` Theodore Ts'o
2014-03-13 3:14 ` Theodore Ts'o
2014-03-13 6:04 ` Dave Chinner
2014-03-13 12:55 ` Theodore Ts'o
2014-03-13 7:39 ` Christoph Hellwig
2014-03-13 14:20 ` [PATCH] fs: push sync_filesystem() down to the file system's remount_fs() Theodore Ts'o
[not found] ` <1394720456-16629-1-git-send-email-tytso-3s7WtUTddSA@public.gmane.org>
2014-03-13 16:23 ` Jan Kara
2014-03-13 16:28 ` Steven Whitehouse
2014-03-13 23:15 ` [Cluster-devel] " Theodore Ts'o
[not found] ` <20140313231506.GB16785-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2014-03-14 12:13 ` Jan Kara
2014-03-14 0:33 ` Steve French
2014-03-14 1:23 ` Theodore Ts'o
2014-03-13 7:19 ` Extremely slow remounts with concurrent I/O Dave Chinner
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=20140310144128.GC10562@thunk.org \
--to=tytso@mit.edu \
--cc=emmanuel.jeanvoine@inria.fr \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=lucas.nussbaum@loria.fr \
/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).