From 1f5abe7e7dbcd83e73212c6cb135a6106cea6a0b Mon Sep 17 00:00:00 2001 From: Ryusuke Konishi Date: Mon, 6 Apr 2009 19:01:55 -0700 Subject: 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 Signed-off-by: Ryusuke Konishi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/nilfs2/super.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'fs/nilfs2/super.c') diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 2f0e9f7bf15..d0639a6aae9 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c @@ -841,8 +841,11 @@ nilfs_fill_super(struct super_block *sb, void *data, int silent, if (sb->s_flags & MS_RDONLY) { if (nilfs_test_opt(sbi, SNAPSHOT)) { - if (!nilfs_cpfile_is_snapshot(nilfs->ns_cpfile, - sbi->s_snapshot_cno)) { + err = nilfs_cpfile_is_snapshot(nilfs->ns_cpfile, + sbi->s_snapshot_cno); + if (err < 0) + goto failed_sbi; + if (!err) { printk(KERN_ERR "NILFS: The specified checkpoint is " "not a snapshot " @@ -1163,7 +1166,6 @@ nilfs_get_sb(struct file_system_type *fs_type, int flags, } else { struct nilfs_sb_info *sbi = NILFS_SB(s); - BUG_ON(!sbi || !sbi->s_nilfs); /* * s_umount protects super_block from unmount process; * It covers pointers of nilfs_sb_info and the_nilfs. -- cgit v1.2.3