summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/dat.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-04-07 04:01:55 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 17:31:19 +0200
commit1f5abe7e7dbcd83e73212c6cb135a6106cea6a0b (patch)
treef80e97297d5badebd31bbb17003d76a4ea30453a /fs/nilfs2/dat.c
parentnilfs2: extend nilfs_sustat ioctl struct (diff)
downloadlinux-1f5abe7e7dbcd83e73212c6cb135a6106cea6a0b.tar.xz
linux-1f5abe7e7dbcd83e73212c6cb135a6106cea6a0b.zip
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/dat.c')
-rw-r--r--fs/nilfs2/dat.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c
index 9360920f7d38..bb8a5818e7f1 100644
--- a/fs/nilfs2/dat.c
+++ b/fs/nilfs2/dat.c
@@ -135,7 +135,7 @@ int nilfs_dat_prepare_start(struct inode *dat, struct nilfs_palloc_req *req)
int ret;
ret = nilfs_dat_prepare_entry(dat, req, 0);
- BUG_ON(ret == -ENOENT);
+ WARN_ON(ret == -ENOENT);
return ret;
}
@@ -157,7 +157,6 @@ void nilfs_dat_commit_start(struct inode *dat, struct nilfs_palloc_req *req,
(unsigned long long)le64_to_cpu(entry->de_start),
(unsigned long long)le64_to_cpu(entry->de_end),
(unsigned long long)le64_to_cpu(entry->de_blocknr));
- BUG();
}
entry->de_blocknr = cpu_to_le64(blocknr);
kunmap_atomic(kaddr, KM_USER0);
@@ -180,7 +179,7 @@ int nilfs_dat_prepare_end(struct inode *dat, struct nilfs_palloc_req *req)
ret = nilfs_dat_prepare_entry(dat, req, 0);
if (ret < 0) {
- BUG_ON(ret == -ENOENT);
+ WARN_ON(ret == -ENOENT);
return ret;
}
@@ -216,7 +215,7 @@ void nilfs_dat_commit_end(struct inode *dat, struct nilfs_palloc_req *req,
end = start = le64_to_cpu(entry->de_start);
if (!dead) {
end = nilfs_mdt_cno(dat);
- BUG_ON(start > end);
+ WARN_ON(start > end);
}
entry->de_end = cpu_to_le64(end);
blocknr = le64_to_cpu(entry->de_blocknr);
@@ -324,14 +323,16 @@ int nilfs_dat_move(struct inode *dat, __u64 vblocknr, sector_t blocknr)
return ret;
kaddr = kmap_atomic(entry_bh->b_page, KM_USER0);
entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr);
- if (entry->de_blocknr == cpu_to_le64(0)) {
+ if (unlikely(entry->de_blocknr == cpu_to_le64(0))) {
printk(KERN_CRIT "%s: vbn = %llu, [%llu, %llu)\n", __func__,
(unsigned long long)vblocknr,
(unsigned long long)le64_to_cpu(entry->de_start),
(unsigned long long)le64_to_cpu(entry->de_end));
- BUG();
+ kunmap_atomic(kaddr, KM_USER0);
+ brelse(entry_bh);
+ return -EINVAL;
}
- BUG_ON(blocknr == 0);
+ WARN_ON(blocknr == 0);
entry->de_blocknr = cpu_to_le64(blocknr);
kunmap_atomic(kaddr, KM_USER0);