aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/dat.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-04-06 22:01:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 11:31:19 -0400
commit1f5abe7e7dbcd83e73212c6cb135a6106cea6a0b (patch)
treef80e97297d5badebd31bbb17003d76a4ea30453a /fs/nilfs2/dat.c
parent2c2e52fc4fca251e68f90821c9ff5cb18be4df58 (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/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)
135 int ret; 135 int ret;
136 136
137 ret = nilfs_dat_prepare_entry(dat, req, 0); 137 ret = nilfs_dat_prepare_entry(dat, req, 0);
138 BUG_ON(ret == -ENOENT); 138 WARN_ON(ret == -ENOENT);
139 return ret; 139 return ret;
140} 140}
141 141
@@ -157,7 +157,6 @@ void nilfs_dat_commit_start(struct inode *dat, struct nilfs_palloc_req *req,
157 (unsigned long long)le64_to_cpu(entry->de_start), 157 (unsigned long long)le64_to_cpu(entry->de_start),
158 (unsigned long long)le64_to_cpu(entry->de_end), 158 (unsigned long long)le64_to_cpu(entry->de_end),
159 (unsigned long long)le64_to_cpu(entry->de_blocknr)); 159 (unsigned long long)le64_to_cpu(entry->de_blocknr));
160 BUG();
161 } 160 }
162 entry->de_blocknr = cpu_to_le64(blocknr); 161 entry->de_blocknr = cpu_to_le64(blocknr);
163 kunmap_atomic(kaddr, KM_USER0); 162 kunmap_atomic(kaddr, KM_USER0);
@@ -180,7 +179,7 @@ int nilfs_dat_prepare_end(struct inode *dat, struct nilfs_palloc_req *req)
180 179
181 ret = nilfs_dat_prepare_entry(dat, req, 0); 180 ret = nilfs_dat_prepare_entry(dat, req, 0);
182 if (ret < 0) { 181 if (ret < 0) {
183 BUG_ON(ret == -ENOENT); 182 WARN_ON(ret == -ENOENT);
184 return ret; 183 return ret;
185 } 184 }
186 185
@@ -216,7 +215,7 @@ void nilfs_dat_commit_end(struct inode *dat, struct nilfs_palloc_req *req,
216 end = start = le64_to_cpu(entry->de_start); 215 end = start = le64_to_cpu(entry->de_start);
217 if (!dead) { 216 if (!dead) {
218 end = nilfs_mdt_cno(dat); 217 end = nilfs_mdt_cno(dat);
219 BUG_ON(start > end); 218 WARN_ON(start > end);
220 } 219 }
221 entry->de_end = cpu_to_le64(end); 220 entry->de_end = cpu_to_le64(end);
222 blocknr = le64_to_cpu(entry->de_blocknr); 221 blocknr = le64_to_cpu(entry->de_blocknr);
@@ -324,14 +323,16 @@ int nilfs_dat_move(struct inode *dat, __u64 vblocknr, sector_t blocknr)
324 return ret; 323 return ret;
325 kaddr = kmap_atomic(entry_bh->b_page, KM_USER0); 324 kaddr = kmap_atomic(entry_bh->b_page, KM_USER0);
326 entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr); 325 entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr);
327 if (entry->de_blocknr == cpu_to_le64(0)) { 326 if (unlikely(entry->de_blocknr == cpu_to_le64(0))) {
328 printk(KERN_CRIT "%s: vbn = %llu, [%llu, %llu)\n", __func__, 327 printk(KERN_CRIT "%s: vbn = %llu, [%llu, %llu)\n", __func__,
329 (unsigned long long)vblocknr, 328 (unsigned long long)vblocknr,
330 (unsigned long long)le64_to_cpu(entry->de_start), 329 (unsigned long long)le64_to_cpu(entry->de_start),
331 (unsigned long long)le64_to_cpu(entry->de_end)); 330 (unsigned long long)le64_to_cpu(entry->de_end));
332 BUG(); 331 kunmap_atomic(kaddr, KM_USER0);
332 brelse(entry_bh);
333 return -EINVAL;
333 } 334 }
334 BUG_ON(blocknr == 0); 335 WARN_ON(blocknr == 0);
335 entry->de_blocknr = cpu_to_le64(blocknr); 336 entry->de_blocknr = cpu_to_le64(blocknr);
336 kunmap_atomic(kaddr, KM_USER0); 337 kunmap_atomic(kaddr, KM_USER0);
337 338