From: Zhang Yi yi.zhang@huawei.com
hulk inclusion category: bugfix bugzilla: 50788 CVE: NA ---------------------------
This reverts commit c18bc51c49fe6a19a0143cf5ae9eb749d30421c1. Prepare to backport fcf37549ae19 ("jbd2: ensure abort the journal if detect IO error when writing original buffer back"), will re-add after backport.
Signed-off-by: Zhang Yi yi.zhang@huawei.com Reviewed-by: Yang Erkun yangerkun@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- fs/jbd2/checkpoint.c | 5 +---- fs/jbd2/journal.c | 19 ++++++------------- include/linux/jbd2.h | 23 +++++------------------ 3 files changed, 12 insertions(+), 35 deletions(-)
diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c index f2c36c9c58be3..b1af15ad36dcb 100644 --- a/fs/jbd2/checkpoint.c +++ b/fs/jbd2/checkpoint.c @@ -562,7 +562,6 @@ int __jbd2_journal_remove_checkpoint(struct journal_head *jh) struct transaction_chp_stats_s *stats; transaction_t *transaction; journal_t *journal; - journal_wrapper_t *journal_wrapper; struct buffer_head *bh = jh2bh(jh);
JBUFFER_TRACE(jh, "entry"); @@ -573,8 +572,6 @@ int __jbd2_journal_remove_checkpoint(struct journal_head *jh) return 0; } journal = transaction->t_journal; - journal_wrapper = container_of(journal, journal_wrapper_t, - jw_journal);
JBUFFER_TRACE(jh, "removing from transaction");
@@ -586,7 +583,7 @@ int __jbd2_journal_remove_checkpoint(struct journal_head *jh) * journal here and we abort the journal later from a better context. */ if (buffer_write_io_error(bh)) - set_bit(JBD2_CHECKPOINT_IO_ERROR, &journal_wrapper->j_atomic_flags); + set_bit(JBD2_CHECKPOINT_IO_ERROR, &journal->j_atomic_flags);
__buffer_unlink(jh); jh->b_cp_transaction = NULL; diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index ef9a942fc9a1a..89fad4c3e13cb 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1129,17 +1129,14 @@ static journal_t *journal_init_common(struct block_device *bdev, { static struct lock_class_key jbd2_trans_commit_key; journal_t *journal; - journal_wrapper_t *journal_wrapper; int err; struct buffer_head *bh; int n;
- journal_wrapper = kzalloc(sizeof(*journal_wrapper), GFP_KERNEL); - if (!journal_wrapper) + journal = kzalloc(sizeof(*journal), GFP_KERNEL); + if (!journal) return NULL;
- journal = &(journal_wrapper->jw_journal); - init_waitqueue_head(&journal->j_wait_transaction_locked); init_waitqueue_head(&journal->j_wait_done_commit); init_waitqueue_head(&journal->j_wait_commit); @@ -1198,7 +1195,7 @@ static journal_t *journal_init_common(struct block_device *bdev, err_cleanup: kfree(journal->j_wbuf); jbd2_journal_destroy_revoke(journal); - kfree(journal_wrapper); + kfree(journal); return NULL; }
@@ -1428,13 +1425,11 @@ int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid, unsigned long tail_block, int write_op) { journal_superblock_t *sb = journal->j_superblock; - journal_wrapper_t *journal_wrapper = container_of(journal, - journal_wrapper_t, jw_journal); int ret;
if (is_journal_aborted(journal)) return -EIO; - if (test_bit(JBD2_CHECKPOINT_IO_ERROR, &journal_wrapper->j_atomic_flags)) { + if (test_bit(JBD2_CHECKPOINT_IO_ERROR, &journal->j_atomic_flags)) { jbd2_journal_abort(journal, -EIO); return -EIO; } @@ -1759,8 +1754,6 @@ int jbd2_journal_load(journal_t *journal) int jbd2_journal_destroy(journal_t *journal) { int err = 0; - journal_wrapper_t *journal_wrapper = container_of(journal, - journal_wrapper_t, jw_journal);
/* Wait for the commit thread to wake up and die. */ journal_kill_thread(journal); @@ -1802,7 +1795,7 @@ int jbd2_journal_destroy(journal_t *journal) * may become inconsistent. */ if (!is_journal_aborted(journal) && - test_bit(JBD2_CHECKPOINT_IO_ERROR, &journal_wrapper->j_atomic_flags)) + test_bit(JBD2_CHECKPOINT_IO_ERROR, &journal->j_atomic_flags)) jbd2_journal_abort(journal, -EIO);
if (journal->j_sb_buffer) { @@ -1830,7 +1823,7 @@ int jbd2_journal_destroy(journal_t *journal) if (journal->j_chksum_driver) crypto_free_shash(journal->j_chksum_driver); kfree(journal->j_wbuf); - kfree(journal_wrapper); + kfree(journal);
return err; } diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index ef213666c3a3b..5c0446f22bee1 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -105,8 +105,6 @@ typedef struct jbd2_journal_handle handle_t; /* Atomic operation type */ * This is an opaque datatype. **/ typedef struct journal_s journal_t; /* Journal control structure */ - -typedef struct journal_wrapper_s journal_wrapper_t; #endif
/* @@ -782,6 +780,11 @@ struct journal_s */ unsigned long j_flags;
+ /** + * @j_atomic_flags: Atomic journaling state flags. + */ + unsigned long j_atomic_flags; + /** * @j_errno: * @@ -1196,22 +1199,6 @@ struct journal_s #endif };
-/** - * struct journal_wrapper_s - The wrapper of journal_s to fix KABI. - */ -struct journal_wrapper_s -{ - /** - * @jw_journal: real journal. - */ - journal_t jw_journal; - - /** - * @j_atomic_flags: Atomic journaling state flags. - */ - unsigned long j_atomic_flags; -}; - #define jbd2_might_wait_for_commit(j) \ do { \ rwsem_acquire(&j->j_trans_commit_map, 0, 0, _THIS_IP_); \