diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-04-06 22:01:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-07 11:31:19 -0400 |
commit | 1f5abe7e7dbcd83e73212c6cb135a6106cea6a0b (patch) | |
tree | f80e97297d5badebd31bbb17003d76a4ea30453a /fs/nilfs2/inode.c | |
parent | 2c2e52fc4fca251e68f90821c9ff5cb18be4df58 (diff) |
nilfs2: replace BUG_ON and BUG calls triggerable from ioctl
Pekka Enberg advised me:
> It would be nice if BUG(), BUG_ON(), and panic() calls would be
> converted to proper error handling using WARN_ON() calls. The BUG()
> call in nilfs_cpfile_delete_checkpoints(), for example, looks to be
> triggerable from user-space via the ioctl() system call.
This will follow the comment and keep them to a minimum.
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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 4bf1e2c5bac6..b6536bb2a324 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -61,12 +61,6 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff, | |||
61 | map_bh(bh_result, inode->i_sb, blknum); | 61 | map_bh(bh_result, inode->i_sb, blknum); |
62 | goto out; | 62 | goto out; |
63 | } | 63 | } |
64 | if (unlikely(ret == 1)) { | ||
65 | printk(KERN_ERR "nilfs_get_block: bmap_lookup returns " | ||
66 | "buffer_head pointer (blkoff=%llu, blknum=%lu)\n", | ||
67 | (unsigned long long)blkoff, blknum); | ||
68 | BUG(); | ||
69 | } | ||
70 | /* data block was not found */ | 64 | /* data block was not found */ |
71 | if (ret == -ENOENT && create) { | 65 | if (ret == -ENOENT && create) { |
72 | struct nilfs_transaction_info ti; | 66 | struct nilfs_transaction_info ti; |
@@ -85,14 +79,14 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff, | |||
85 | * However, the page having this block must | 79 | * However, the page having this block must |
86 | * be locked in this case. | 80 | * be locked in this case. |
87 | */ | 81 | */ |
88 | printk(KERN_ERR | 82 | printk(KERN_WARNING |
89 | "nilfs_get_block: a race condition " | 83 | "nilfs_get_block: a race condition " |
90 | "while inserting a data block. " | 84 | "while inserting a data block. " |
91 | "(inode number=%lu, file block " | 85 | "(inode number=%lu, file block " |
92 | "offset=%llu)\n", | 86 | "offset=%llu)\n", |
93 | inode->i_ino, | 87 | inode->i_ino, |
94 | (unsigned long long)blkoff); | 88 | (unsigned long long)blkoff); |
95 | BUG(); | 89 | err = 0; |
96 | } else if (err == -EINVAL) { | 90 | } else if (err == -EINVAL) { |
97 | nilfs_error(inode->i_sb, __func__, | 91 | nilfs_error(inode->i_sb, __func__, |
98 | "broken bmap (inode=%lu)\n", | 92 | "broken bmap (inode=%lu)\n", |
@@ -621,7 +615,6 @@ void nilfs_truncate(struct inode *inode) | |||
621 | struct nilfs_transaction_info ti; | 615 | struct nilfs_transaction_info ti; |
622 | struct super_block *sb = inode->i_sb; | 616 | struct super_block *sb = inode->i_sb; |
623 | struct nilfs_inode_info *ii = NILFS_I(inode); | 617 | struct nilfs_inode_info *ii = NILFS_I(inode); |
624 | int ret; | ||
625 | 618 | ||
626 | if (!test_bit(NILFS_I_BMAP, &ii->i_state)) | 619 | if (!test_bit(NILFS_I_BMAP, &ii->i_state)) |
627 | return; | 620 | return; |
@@ -630,8 +623,7 @@ void nilfs_truncate(struct inode *inode) | |||
630 | 623 | ||
631 | blocksize = sb->s_blocksize; | 624 | blocksize = sb->s_blocksize; |
632 | blkoff = (inode->i_size + blocksize - 1) >> sb->s_blocksize_bits; | 625 | blkoff = (inode->i_size + blocksize - 1) >> sb->s_blocksize_bits; |
633 | ret = nilfs_transaction_begin(sb, &ti, 0); | 626 | nilfs_transaction_begin(sb, &ti, 0); /* never fails */ |
634 | BUG_ON(ret); | ||
635 | 627 | ||
636 | block_truncate_page(inode->i_mapping, inode->i_size, nilfs_get_block); | 628 | block_truncate_page(inode->i_mapping, inode->i_size, nilfs_get_block); |
637 | 629 | ||
@@ -652,7 +644,6 @@ void nilfs_delete_inode(struct inode *inode) | |||
652 | struct nilfs_transaction_info ti; | 644 | struct nilfs_transaction_info ti; |
653 | struct super_block *sb = inode->i_sb; | 645 | struct super_block *sb = inode->i_sb; |
654 | struct nilfs_inode_info *ii = NILFS_I(inode); | 646 | struct nilfs_inode_info *ii = NILFS_I(inode); |
655 | int err; | ||
656 | 647 | ||
657 | if (unlikely(is_bad_inode(inode))) { | 648 | if (unlikely(is_bad_inode(inode))) { |
658 | if (inode->i_data.nrpages) | 649 | if (inode->i_data.nrpages) |
@@ -660,8 +651,8 @@ void nilfs_delete_inode(struct inode *inode) | |||
660 | clear_inode(inode); | 651 | clear_inode(inode); |
661 | return; | 652 | return; |
662 | } | 653 | } |
663 | err = nilfs_transaction_begin(sb, &ti, 0); | 654 | nilfs_transaction_begin(sb, &ti, 0); /* never fails */ |
664 | BUG_ON(err); | 655 | |
665 | if (inode->i_data.nrpages) | 656 | if (inode->i_data.nrpages) |
666 | truncate_inode_pages(&inode->i_data, 0); | 657 | truncate_inode_pages(&inode->i_data, 0); |
667 | 658 | ||