Skip to contentSkip to conversation

JBD2: print io_block if check data block checksum failed when do recovery

PATCH Superseded Ye Bin 2 participants 5 messages Sep 4, 2023 Journalling layer for block devices (JBD2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ye Bin

author
#0 lore raw

cover JBD2: print io_block if check data block checksum failed when do recovery

Ye Bin (2):
JBD2: print io_block if check data block checksum failed when do
recovery
JBD2: fix printk format type for 'io_block' in do_one_pass()

 fs/jbd2/recovery.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH 1/2 JBD2: print io_block if check data block checksum failed when do recovery

Now, if check data block checksum failed only print data's block number then skip write data. However, one data block may in more than one transaction. In some scenarios, offline analysis is inconvenient. As a result, it is difficult to locate the areas where data is faulty.
So print 'io_block' if check data block checksum failed.

---
 fs/jbd2/recovery.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jbd2/recovery.c +2 -1
index c269a7d29a46..a2e2bdaed9f8 100644
@@ -661,7 +661,8 @@ static int do_one_pass(journal_t *journal,
 						printk(KERN_ERR "JBD2: Invalid "
 						       "checksum recovering "
 						       "data block %llu in "
-						       "log\n", blocknr);
+						       "log %lu\n", blocknr,
+						       io_block);
 						block_error = 1;
 						goto skip_write;
 					}
Signature · 1 line
2.31.1
Reviewed-by on v1 1/2
#2 lore raw
Quoted 16 lines · Ye Bin

Now, if check data block checksum failed only print data's block number then skip write data. However, one data block may in more than one transaction. In some scenarios, offline analysis is inconvenient. As a result, it is difficult to locate the areas where data is faulty.
So print 'io_block' if check data block checksum failed.

---
 fs/jbd2/recovery.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jbd2/recovery.c +0 -0
index c269a7d29a46..a2e2bdaed9f8 100644

fs/jbd2/recovery.c static int do_one_pass(journal_t *journal, · line 664

Quoted 5 lines
fs/jbd2/recovery.c +1 -1
@@ -661,7 +661,8 @@ static int do_one_pass(journal_t *journal,
 						printk(KERN_ERR "JBD2: Invalid "
 						       "checksum recovering "
 						       "data block %llu in "
-						       "log\n", blocknr);
+						       "log %lu\n", blocknr,

I'd make the message "...in journal block %lu\n". Otherwise the patch looks good so feel free to add:

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
author
#3 lore raw

PATCH 2/2 JBD2: fix printk format type for 'io_block' in do_one_pass()

In reply to Ye Bin

'io_block' is unsinged long but print it by '%ld'.

---
 fs/jbd2/recovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jbd2/recovery.c +1 -1
index a2e2bdaed9f8..d10dc7f64301 100644
@@ -632,7 +632,7 @@ static int do_one_pass(journal_t *journal,
 					success = err;
 					printk(KERN_ERR
 						"JBD2: IO error %d recovering "
-						"block %ld in log\n",
+						"block %lu in log\n",
 						err, io_block);
 				} else {
 					unsigned long long blocknr;
Signature · 1 line
2.31.1
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] JBD2: fix printk format type for 'io_block' in do_one_pass()

Quoted 3 lines · Ye Bin

'io_block' is unsinged long but print it by '%ld'.

Looks good. Feel free to add:

Honza

Quoted 20 lines
---
 fs/jbd2/recovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/jbd2/recovery.c +1 -1
index a2e2bdaed9f8..d10dc7f64301 100644
@@ -632,7 +632,7 @@ static int do_one_pass(journal_t *journal,
 					success = err;
 					printk(KERN_ERR
 						"JBD2: IO error %d recovering "
-						"block %ld in log\n",
+						"block %lu in log\n",
 						err, io_block);
 				} else {
 					unsigned long long blocknr;
Signature · 1 line
2.31.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR