JFS: [4 of 6] Add debug code to help catch elusive bug
Dave Kleikamp <[email protected]> Wed, 26 Feb 2003 11:28:30 -0600
| Newsgroups | gmane.comp.file-systems.jfs.patches |
|---|---|
| Message-ID | <[email protected]> |
# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.967 -> 1.967.4.1 # fs/jfs/jfs_dmap.c 1.6 -> 1.7 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/02/12 [email protected] 1.967.4.1 # JFS: Add debug code to help catch elusive bug # -------------------------------------------- # diff -Nru a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c --- a/fs/jfs/jfs_dmap.c Wed Feb 26 11:11:02 2003 +++ b/fs/jfs/jfs_dmap.c Wed Feb 26 11:11:02 2003 @@ -22,6 +22,7 @@ #include "jfs_imap.h" #include "jfs_lock.h" #include "jfs_metapage.h" +#include "jfs_superblock.h" #include "jfs_debug.h" /* @@ -381,7 +382,22 @@ IREAD_LOCK(ipbmap); /* block to be freed better be within the mapsize. */ - assert(blkno + nblocks <= bmp->db_mapsize); + if (unlikely(blkno + nblocks > bmp->db_mapsize)) { + /* + * Trying to catch a bug here + */ + printk(KERN_ERR + "JFS: dbFree asked to free block larger than mapsize\n"); + printk(KERN_ERR + "blkno = 0x%Lx, nblocks = 0x%Lx, mapsize = 0x%Lx\n", + blkno, nblocks, bmp->db_mapsize); + printk(KERN_ERR "ino = %ld, cflag = %lx\n", ip->i_ino, + JFS_IP(ip)->cflag); + dump_stack(); + /* Make sure fsck fixes things back up */ + updateSuper(ip->i_sb, FM_DIRTY); + return -EIO; /* Nobody checks the return code */ + } /* * free the blocks a dmap at a time.