diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-11-19 01:26:20 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-01-10 00:05:45 -0500 |
commit | e828949e5b42bfd234ee537cdb7c5e3a577958a3 (patch) | |
tree | c2e259a3020acdb943669fb01e5a7dc5598a6fe9 /fs/nilfs2/inode.c | |
parent | b004a5eb0babec7ef91558f73315ef49e5a1f285 (diff) |
nilfs2: call nilfs_error inside bmap routines
Some functions using nilfs bmap routines can wrongly return invalid
argument error (i.e. -EINVAL) that bmap returns as an internal code
for btree corruption.
This fixes the issue by catching and converting the internal EINVAL to
EIO and calling nilfs_error function inside bmap routines.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/inode.c')
-rw-r--r-- | fs/nilfs2/inode.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 77b48c8fab17..550b1788981e 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -96,11 +96,6 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff, | |||
96 | inode->i_ino, | 96 | inode->i_ino, |
97 | (unsigned long long)blkoff); | 97 | (unsigned long long)blkoff); |
98 | err = 0; | 98 | err = 0; |
99 | } else if (err == -EINVAL) { | ||
100 | nilfs_error(inode->i_sb, __func__, | ||
101 | "broken bmap (inode=%lu)\n", | ||
102 | inode->i_ino); | ||
103 | err = -EIO; | ||
104 | } | 99 | } |
105 | nilfs_transaction_abort(inode->i_sb); | 100 | nilfs_transaction_abort(inode->i_sb); |
106 | goto out; | 101 | goto out; |
@@ -629,7 +624,7 @@ static void nilfs_truncate_bmap(struct nilfs_inode_info *ii, | |||
629 | 624 | ||
630 | if (!test_bit(NILFS_I_BMAP, &ii->i_state)) | 625 | if (!test_bit(NILFS_I_BMAP, &ii->i_state)) |
631 | return; | 626 | return; |
632 | repeat: | 627 | repeat: |
633 | ret = nilfs_bmap_last_key(ii->i_bmap, &b); | 628 | ret = nilfs_bmap_last_key(ii->i_bmap, &b); |
634 | if (ret == -ENOENT) | 629 | if (ret == -ENOENT) |
635 | return; | 630 | return; |
@@ -646,14 +641,10 @@ static void nilfs_truncate_bmap(struct nilfs_inode_info *ii, | |||
646 | nilfs_bmap_truncate(ii->i_bmap, b) == 0)) | 641 | nilfs_bmap_truncate(ii->i_bmap, b) == 0)) |
647 | goto repeat; | 642 | goto repeat; |
648 | 643 | ||
649 | failed: | 644 | failed: |
650 | if (ret == -EINVAL) | 645 | nilfs_warning(ii->vfs_inode.i_sb, __func__, |
651 | nilfs_error(ii->vfs_inode.i_sb, __func__, | 646 | "failed to truncate bmap (ino=%lu, err=%d)", |
652 | "bmap is broken (ino=%lu)", ii->vfs_inode.i_ino); | 647 | ii->vfs_inode.i_ino, ret); |
653 | else | ||
654 | nilfs_warning(ii->vfs_inode.i_sb, __func__, | ||
655 | "failed to truncate bmap (ino=%lu, err=%d)", | ||
656 | ii->vfs_inode.i_ino, ret); | ||
657 | } | 648 | } |
658 | 649 | ||
659 | void nilfs_truncate(struct inode *inode) | 650 | void nilfs_truncate(struct inode *inode) |