All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ted Ts'o <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/6] jbd2: Issue cache flush after checkpointing even with internal journal
Date: Wed, 8 Feb 2012 22:05:51 -0500	[thread overview]
Message-ID: <20120209030551.GH18461@thunk.org> (raw)
In-Reply-To: <20120111124918.GD26337@quack.suse.cz>

Hi Jan,

Am I missing something?  In the original code, we figure out the block
# of the tail of the journal while holding the j_state_lock for
writing, and we hold the lock until journal->j_tail is updated.

In your proposed replacement code, you call
jbd2_journal_get_log_tail() to determine the block #, but you aren't
holding any locks.  jbd2_journal_get_log_tail() grabs a read lock to
figure out the block number, but then drops the lock before it
returns.  So then journal->j_tail gets updated by
jbd2_journal_update_tail() --- using the block # determined by
jbd2_journal_get_log_tail(), but we've released the lock, so can we
guarantee the block number is still accurate?

In particular, since jbd2_cleanup_journal_tail() is now not holding
any locks, what if it is racing against itself?  I can't quite see
race that would lead to something horrible happening, but my spidey
sense is tingling....

Also:

> +/*
> + * Update information in journal about log tail. The function returns 1 if
> + * tail was updated, 0 otherwise. If 1 is returned, caller *must* write
> + * journal superblock before next transaction commit is started.
> + */

If jbd2_update_log_tail() returns 1, how is this enforced?  The caller
can issue a journal superblocok update, sure, but there's no locking
to prevent some other process from immediately starting a new
transaction?

Again, am I missing something?

Regards,

							- Ted

  reply	other threads:[~2012-02-09  3:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  0:31 [PATCH 0/6] jbd2: Checkpointing fix and cleanups Jan Kara
2012-01-11  0:31 ` [PATCH 1/6] jbd2: Issue cache flush after checkpointing even with internal journal Jan Kara
2012-01-11 12:49   ` Jan Kara
2012-02-09  3:05     ` Ted Ts'o [this message]
2012-02-09  5:26       ` Theodore Tso
2012-02-10 13:58         ` Jan Kara
2012-02-10 13:55       ` Jan Kara
2012-01-11  0:31 ` [PATCH 2/6] jbd2: Fix BH_JWrite setting in checkpointing code Jan Kara
2012-01-11  0:31 ` [PATCH 3/6] jbd2: __jbd2_journal_temp_unlink_buffer() is static Jan Kara
2012-01-11  0:31 ` [PATCH 4/6] jbd2: Remove always true condition in __journal_try_to_free_buffer() Jan Kara
2012-01-11  0:31 ` [PATCH 5/6] jbd2: Remove bh_state lock from checkpointing code Jan Kara
2012-01-11  0:31 ` [PATCH 6/6] jbd2: Cleanup journal tail after transaction commit Jan Kara

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=20120209030551.GH18461@thunk.org \
    --to=tytso@mit.edu \
    --cc=jack@suse.cz \
    --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 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.