Skip to contentSkip to conversation

64bit JBD patch bug!

DISCUSSION 张军伟 2 participants 2 messages Sep 15, 2006 – Sep 19, 2006 VFS

lore
Share & tools
lore

张军伟

author
#0 lore raw

I think I have found a bug of 64bit JBD patches!

in 64bit_JBD_core.patch

"while(offset + record_len < max) {"
must be changed to
"while(offset + record_len <= max) {"
or
"while(offset < max) {" just same as original

otherwise the last revoke record will be ignored!

@@ -571,17 +580,24 @@ static int scan_revoke_records(journal_t
{
journal_revoke_header_t *header;
int offset, max;
+ int record_len = 4;

header = (journal_revoke_header_t *) bh->b_data; offset = sizeof(journal_revoke_header_t); max = be32_to_cpu(header->r_count);

- while (offset < max) {
+ if (JFS_HAS_INCOMPAT_FEATURE(journal, JFS_FEATURE_INCOMPAT_64BIT))
+ record_len = 8;
+
+ while (offset + record_len < max) {
/* changes here */

Quoted 1 line
Quoted 1 line
Quoted 1 line

while (offset + record_len <= max) {

unsigned long blocknr;
int err;

- blocknr = be32_to_cpu(* ((__be32 *) (bh->b_data+offset)));
- offset += 4;
+ if (record_len == 4)
+ blocknr = be32_to_cpu(* ((__be32 *)
(bh->b_data+offset)));
+ else
+ blocknr = be64_to_cpu(* ((__be64 *)
(bh->b_data+offset)));
+ offset += record_len;
err = journal_set_revoke(journal, blocknr, sequence); if (err)
return err;

#1 lore raw

Anyone can help me!

I think I have found a bug of 64bit JBD patches!

in 64bit_JBD_core.patch

"while(offset + record_len < max) {"
must be changed to
"while(offset + record_len <= max) {"
or
"while(offset < max) {" just same as original

otherwise the last revoke record will be ignored!

@@ -571,17 +580,24 @@ static int scan_revoke_records(journal_t
{
journal_revoke_header_t *header;
int offset, max;
+ int record_len = 4;

header = (journal_revoke_header_t *) bh->b_data; offset = sizeof(journal_revoke_header_t); max = be32_to_cpu(header->r_count);

- while (offset < max) {
+ if (JFS_HAS_INCOMPAT_FEATURE(journal, JFS_FEATURE_INCOMPAT_64BIT))
+ record_len = 8;
+
+ while (offset + record_len < max) {
/* changes here */

Quoted 1 line
Quoted 1 line
Quoted 1 line

while (offset + record_len <= max) {

unsigned long blocknr;
int err;

- blocknr = be32_to_cpu(* ((__be32 *) (bh->b_data+offset)));
- offset += 4;
+ if (record_len == 4)
+ blocknr = be32_to_cpu(* ((__be32 *)
(bh->b_data+offset)));
+ else
+ blocknr = be64_to_cpu(* ((__be64 *)
(bh->b_data+offset)));
+ offset += record_len;
err = journal_set_revoke(journal, blocknr, sequence); if (err)
return err;

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html