File tree Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -1534,6 +1534,7 @@ static journal_t *journal_init_common(struct block_device *bdev,
1534
1534
journal -> j_fs_dev = fs_dev ;
1535
1535
journal -> j_blk_offset = start ;
1536
1536
journal -> j_total_len = len ;
1537
+ jbd2_init_fs_dev_write_error (journal );
1537
1538
1538
1539
err = journal_load_superblock (journal );
1539
1540
if (err )
Original file line number Diff line number Diff line change @@ -289,8 +289,6 @@ int jbd2_journal_recover(journal_t *journal)
289
289
journal_superblock_t * sb ;
290
290
291
291
struct recovery_info info ;
292
- errseq_t wb_err ;
293
- struct address_space * mapping ;
294
292
295
293
memset (& info , 0 , sizeof (info ));
296
294
sb = journal -> j_superblock ;
@@ -308,9 +306,6 @@ int jbd2_journal_recover(journal_t *journal)
308
306
return 0 ;
309
307
}
310
308
311
- wb_err = 0 ;
312
- mapping = journal -> j_fs_dev -> bd_inode -> i_mapping ;
313
- errseq_check_and_advance (& mapping -> wb_err , & wb_err );
314
309
err = do_one_pass (journal , & info , PASS_SCAN );
315
310
if (!err )
316
311
err = do_one_pass (journal , & info , PASS_REVOKE );
@@ -334,7 +329,7 @@ int jbd2_journal_recover(journal_t *journal)
334
329
err2 = sync_blockdev (journal -> j_fs_dev );
335
330
if (!err )
336
331
err = err2 ;
337
- err2 = errseq_check_and_advance ( & mapping -> wb_err , & wb_err );
332
+ err2 = jbd2_check_fs_dev_write_error ( journal );
338
333
if (!err )
339
334
err = err2 ;
340
335
/* Make sure all replayed data is on permanent storage */
Original file line number Diff line number Diff line change @@ -998,6 +998,13 @@ struct journal_s
998
998
*/
999
999
struct block_device * j_fs_dev ;
1000
1000
1001
+ /**
1002
+ * @j_fs_dev_wb_err:
1003
+ *
1004
+ * Records the errseq of the client fs's backing block device.
1005
+ */
1006
+ errseq_t j_fs_dev_wb_err ;
1007
+
1001
1008
/**
1002
1009
* @j_total_len: Total maximum capacity of the journal region on disk.
1003
1010
*/
@@ -1698,6 +1705,25 @@ static inline void jbd2_journal_abort_handle(handle_t *handle)
1698
1705
handle -> h_aborted = 1 ;
1699
1706
}
1700
1707
1708
+ static inline void jbd2_init_fs_dev_write_error (journal_t * journal )
1709
+ {
1710
+ struct address_space * mapping = journal -> j_fs_dev -> bd_inode -> i_mapping ;
1711
+
1712
+ /*
1713
+ * Save the original wb_err value of client fs's bdev mapping which
1714
+ * could be used to detect the client fs's metadata async write error.
1715
+ */
1716
+ errseq_check_and_advance (& mapping -> wb_err , & journal -> j_fs_dev_wb_err );
1717
+ }
1718
+
1719
+ static inline int jbd2_check_fs_dev_write_error (journal_t * journal )
1720
+ {
1721
+ struct address_space * mapping = journal -> j_fs_dev -> bd_inode -> i_mapping ;
1722
+
1723
+ return errseq_check (& mapping -> wb_err ,
1724
+ READ_ONCE (journal -> j_fs_dev_wb_err ));
1725
+ }
1726
+
1701
1727
#endif /* __KERNEL__ */
1702
1728
1703
1729
/* Comparison functions for transaction IDs: perform comparisons using
You can’t perform that action at this time.
0 commit comments