linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Dmitry Monakhov <dmonakhov@openvz.org>
Cc: Jan Kara <jack@suse.cz>, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/5] jbd2: optimize jbd2_journal_force_commit
Date: Tue, 23 Apr 2013 10:51:40 +0200	[thread overview]
Message-ID: <20130423085140.GB4596@quack.suse.cz> (raw)
In-Reply-To: <87k3nvhtnk.fsf@openvz.org>

On Mon 22-04-13 12:11:11, Dmitry Monakhov wrote:
> On Thu, 18 Apr 2013 20:07:27 +0200, Jan Kara <jack@suse.cz> wrote:
> > On Wed 17-04-13 11:39:27, Dmitry Monakhov wrote:
> > > On Mon, 15 Apr 2013 14:29:13 +0200, Jan Kara <jack@suse.cz> wrote:
> > > > On Sun 14-04-13 23:01:34, Dmitry Monakhov wrote:
> > > > > Current implementation of jbd2_journal_force_commit() is suboptimal because
> > > > > result in empty and useless commits. But callers just want to force and wait
> > > > > any unfinished commits. We already has jbd2_journal_force_commit_nested()
> > > > > which does exactly what we want, except we are guaranteed that we do not hold
> > > > > journal transaction open.
> > > >   Umm, I have a questions regarding this patch:
> > > > Grep shows there are just two places in the code which use
> > > > ext4_force_commit() (and thus jbd2_journal_force_commit()). These are
> > > > ext4_write_inode() and ext4_sync_file() (in data=journal mode). The first
> > > > callsite can use _nested() variant immediately as we even assert there's
> > > > no handle started. The second call site can use the _nested variant as well
> > > > because if we had the transaction started when entering ext4_sync_file() we
> > > > would have serious problems (lock inversion, deadlocks in !data=journal
> > > > modes) anyway. So IMO there's no need for !nested variant at all (at least
> > > > in ext4, ocfs2 uses it as well, IMHO it can be converted as well but that's
> > > > a different topic). Thoughts?
> > > I'm not sure that I completely understand what you meant, but it seems
> > > incorrect to use jbd2_journal_force_commit_nested() in 
> > > ext4_write_inode() and ext4_sync_file(). Because nested variant has
> > > probabilistic behavior, It may skip real transaction commit if we hold
> > > a transaction running.  ext4_write_inode() and ext4_sync_file() 
> > > are the functions where we demand deterministic behavior. If we silently
> > > miss real transaction commit because current->journal_info != NULL (due
> > > to some bugs) this breaks data integrity assumptions and it is better to
> > > make it loud and trigger a BUGON.
> >   I see. I was confused by the fact that 'nested' argument got used only in
> > the assertion but now I see why that is.
> Do you give me your ACK/Reviewed  signature?
  Looking at it with a fresh mind I think there's still one bug:
 	read_unlock(&journal->j_state_lock);
 	if (need_to_start)
-		jbd2_log_start_commit(journal, tid);
-	jbd2_log_wait_commit(journal, tid);
-	return 1;
+		ret = jbd2_log_start_commit(journal, tid);
+	if (!ret)
+		ret = jbd2_log_wait_commit(journal, tid);
  jbd2_log_start_commit() will return 0 if it didn't wake jbd2 thread and 1
if it did. In either case we should call jbd2_log_wait_commit()...

+	if (!ret && progress)
+		*progress = 1;

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2013-04-23  8:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14 19:01 [PATCH 1/5] ext4: convert write_begin methods to stable_page_writes semantics Dmitry Monakhov
2013-04-14 19:01 ` [PATCH 2/5] jbd2: optimize jbd2_journal_force_commit Dmitry Monakhov
2013-04-15 12:29   ` Jan Kara
2013-04-17  7:39     ` Dmitry Monakhov
2013-04-18 18:07       ` Jan Kara
2013-04-22  8:11         ` Dmitry Monakhov
2013-04-23  8:51           ` Jan Kara [this message]
2013-08-28 18:33             ` Theodore Ts'o
2013-04-14 19:01 ` [PATCH 3/5] ext4: fix data integrity for ext4_sync_fs Dmitry Monakhov
2013-04-15 13:59   ` Jan Kara
2013-04-14 19:01 ` [PATCH 4/5] jbd: optimize journal_force_commit Dmitry Monakhov
2013-04-14 19:01 ` [PATCH 5/5] ext3: fix data integrity for ext4_sync_fs Dmitry Monakhov
2013-04-15 12:01 ` [PATCH 1/5] ext4: convert write_begin methods to stable_page_writes semantics Jan Kara
2013-04-22 12:36 ` Zheng Liu
2013-08-28 18:32 ` Theodore Ts'o

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=20130423085140.GB4596@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=dmonakhov@openvz.org \
    --cc=linux-ext4@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).