From: "zhangyi (F)" <yi.zhang@huawei.com> To: <linux-ext4@vger.kernel.org> Cc: <jack@suse.com>, <tytso@mit.edu>, <adilger.kernel@dilger.ca>, <yi.zhang@huawei.com>, <liangyun2@huawei.com>, <luoshijie1@huawei.com> Subject: [PATCH v3 2/4] ext4, jbd2: ensure panic when aborting with zero errno Date: Wed, 4 Dec 2019 20:46:12 +0800 Message-ID: <20191204124614.45424-3-yi.zhang@huawei.com> (raw) In-Reply-To: <20191204124614.45424-1-yi.zhang@huawei.com> JBD2_REC_ERR flag used to indicate the errno has been updated when jbd2 aborted, and then __ext4_abort() and ext4_handle_error() can invoke panic if ERRORS_PANIC is specified. But if the journal has been aborted with zero errno, jbd2_journal_abort() didn't set this flag so we can no longer panic. Fix this by always record the proper errno in the journal superblock. Fixes: 4327ba52afd03 ("ext4, jbd2: ensure entering into panic after recording an error in superblock") Signed-off-by: zhangyi (F) <yi.zhang@huawei.com> --- fs/jbd2/checkpoint.c | 2 +- fs/jbd2/journal.c | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index a1909066bde6..62cf497f18eb 100644 --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c @@ -164,7 +164,7 @@ void __jbd2_log_wait_for_space(journal_t *journal) "journal space in %s\n", __func__, journal->j_devname); WARN_ON(1); - jbd2_journal_abort(journal, 0); + jbd2_journal_abort(journal, -EIO); } write_lock(&journal->j_state_lock); } else { diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index 1c58859aa592..b2d6e7666d0f 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -2118,12 +2118,10 @@ static void __journal_abort_soft (journal_t *journal, int errno) __jbd2_journal_abort_hard(journal); - if (errno) { - jbd2_journal_update_sb_errno(journal); - write_lock(&journal->j_state_lock); - journal->j_flags |= JBD2_REC_ERR; - write_unlock(&journal->j_state_lock); - } + jbd2_journal_update_sb_errno(journal); + write_lock(&journal->j_state_lock); + journal->j_flags |= JBD2_REC_ERR; + write_unlock(&journal->j_state_lock); } /** @@ -2165,11 +2163,6 @@ static void __journal_abort_soft (journal_t *journal, int errno) * failure to disk. ext3_error, for example, now uses this * functionality. * - * Errors which originate from within the journaling layer will NOT - * supply an errno; a null errno implies that absolutely no further - * writes are done to the journal (unless there are any already in - * progress). - * */ void jbd2_journal_abort(journal_t *journal, int errno) -- 2.17.2
next prev parent reply index Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-04 12:46 [PATCH v3 0/4] ext4, jbd2: improve aborting progress zhangyi (F) 2019-12-04 12:46 ` [PATCH v3 1/4] jbd2: switch to use jbd2_journal_abort() when failed to submit the commit record zhangyi (F) 2019-12-04 12:46 ` zhangyi (F) [this message] 2019-12-04 12:52 ` [PATCH v3 2/4] ext4, jbd2: ensure panic when aborting with zero errno Jan Kara 2019-12-04 12:46 ` [PATCH v3 3/4] jbd2: make sure ESHUTDOWN to be recorded in the journal superblock zhangyi (F) 2019-12-04 17:05 ` Jan Kara 2019-12-05 1:23 ` zhangyi (F) 2019-12-04 12:46 ` [PATCH v3 4/4] jbd2: clean __jbd2_journal_abort_hard() and __journal_abort_soft() zhangyi (F) 2019-12-04 17:05 ` Jan Kara
Reply instructions: You may reply publically 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=20191204124614.45424-3-yi.zhang@huawei.com \ --to=yi.zhang@huawei.com \ --cc=adilger.kernel@dilger.ca \ --cc=jack@suse.com \ --cc=liangyun2@huawei.com \ --cc=linux-ext4@vger.kernel.org \ --cc=luoshijie1@huawei.com \ --cc=tytso@mit.edu \ /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
Linux-ext4 Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-ext4/0 linux-ext4/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-ext4 linux-ext4/ https://lore.kernel.org/linux-ext4 \ linux-ext4@vger.kernel.org public-inbox-index linux-ext4 Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-ext4 AGPL code for this site: git clone https://public-inbox.org/public-inbox.git