Commit f5ce5a08a40f2086435858ddc80cb40394b082eb

Authored by Sunil Mushran
Committed by Tao Ma
1 parent dc696aced9

ocfs2: Fix incorrect checksum validation error

For local mounts, ocfs2_read_locked_inode() calls ocfs2_read_blocks_sync() to
read the inode off the disk. The latter first checks to see if that block is
cached in the journal, and, if so, returns that block. That is ok.

But ocfs2_read_locked_inode() goes wrong when it tries to validate the checksum
of such blocks. Blocks that are cached in the journal may not have had their
checksum computed as yet. We should not validate the checksums of such blocks.

Fixes ossbz#1282
http://oss.oracle.com/bugzilla/show_bug.cgi?id=1282

Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Cc: stable@kernel.org
Singed-off-by: Tao Ma <tao.ma@oracle.com>

Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff

... ... @@ -488,7 +488,11 @@
488 488 OCFS2_BH_IGNORE_CACHE);
489 489 } else {
490 490 status = ocfs2_read_blocks_sync(osb, args->fi_blkno, 1, &bh);
491   - if (!status)
  491 + /*
  492 + * If buffer is in jbd, then its checksum may not have been
  493 + * computed as yet.
  494 + */
  495 + if (!status && !buffer_jbd(bh))
492 496 status = ocfs2_validate_inode_block(osb->sb, bh);
493 497 }
494 498 if (status < 0) {