linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daeho Jeong <daeho.jeong@samsung.com>
To: linux-ext4@vger.kernel.org
Subject: [PATCH] ext4, jbd2: add REQ_FUA flag when recording an error flag
Date: Tue, 23 Jun 2015 02:19:19 +0000 (GMT)	[thread overview]
Message-ID: <1153399123.83011435025959601.JavaMail.weblogic@ep2mlwas05d> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 2119 bytes --]

When an error condition is detected, an error status should be recorded into
superblocks of EXT4 or JBD2. However, the write request is submitted now
without REQ_FUA flag, even in "barrier=1" mode, which is followed by
panic() function in "errors=panic" mode. On mobile devices which make
whole system reset as soon as kernel panic occurs, this write request
containing an error flag will disappear just from storage cache without
written to the physical cells. Therefore, when next start, even forever,
the error flag cannot be shown in both superblocks, and e2fsck cannot fix
the filesystem problems automatically, unless e2fsck is executed in
force checking mode.

Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
---
 fs/ext4/super.c   |    6 +++++-
 fs/jbd2/journal.c |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index ca9d4a2..4194328 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4588,6 +4588,7 @@ static int ext4_commit_super(struct super_block *sb, int sync)
 {
  struct ext4_super_block *es = EXT4_SB(sb)->s_es;
  struct buffer_head *sbh = EXT4_SB(sb)->s_sbh;
+ journal_t *journal = EXT4_SB(sb)->s_journal;
  int error = 0;
 
  if (!sbh)
@@ -4638,7 +4639,10 @@ static int ext4_commit_super(struct super_block *sb, int sync)
  ext4_superblock_csum_set(sb);
  mark_buffer_dirty(sbh);
  if (sync) {
-  error = sync_dirty_buffer(sbh);
+  if (journal->j_flags & JBD2_BARRIER)
+   error = __sync_dirty_buffer(sbh, WRITE_FUA);
+  else
+   error = sync_dirty_buffer(sbh);
   if (error)
    return error;
 
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index b96bd80..5b9693d 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1455,7 +1455,7 @@ void jbd2_journal_update_sb_errno(journal_t *journal)
  sb->s_errno    = cpu_to_be32(journal->j_errno);
  read_unlock(&journal->j_state_lock);
 
- jbd2_write_superblock(journal, WRITE_SYNC);
+ jbd2_write_superblock(journal, WRITE_FUA);
 }
 EXPORT_SYMBOL(jbd2_journal_update_sb_errno);
 
N‹§²æìr¸›yúèšØb²X¬¶Ç§vØ^–)Þº{.nÇ+‰·¥Š{±{^[xŠ

             reply	other threads:[~2015-06-23  2:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-23  2:19 Daeho Jeong [this message]
     [not found] ` <CAFKwG1g2_+XsdT0pQcNTEYg4SAxDtewYnMsJcS7Hop_FMoEQ5g@mail.gmail.com>
2015-07-23 13:48   ` [PATCH] ext4, jbd2: add REQ_FUA flag when recording an error flag 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=1153399123.83011435025959601.JavaMail.weblogic@ep2mlwas05d \
    --to=daeho.jeong@samsung.com \
    --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).