Message ID | 20081223104016.GC7217@localhost.localdomain |
---|---|
State | Superseded, archived |
Headers | show |
On Tue, Dec 23, 2008 at 07:40:18PM +0900, Akinobu Mita wrote: > kmem_cache_alloc() error in ext4_mb_free_metadata is not handled. > I don't know how to fix it. But I can put BUG_ON to let others > know the problem. > > Cc: Theodore Tso <tytso@mit.edu> > Cc: adilger@sun.com > Cc: linux-ext4@vger.kernel.org > Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> > --- > fs/ext4/mballoc.c | 1 + > 1 file changed, 1 insertion(+) > > Index: 2.6-rc/fs/ext4/mballoc.c > =================================================================== > --- 2.6-rc.orig/fs/ext4/mballoc.c > +++ 2.6-rc/fs/ext4/mballoc.c > @@ -4417,6 +4417,7 @@ ext4_mb_free_metadata(handle_t *handle, > BUG_ON(e4b->bd_buddy_page == NULL); > > new_entry = kmem_cache_alloc(ext4_free_ext_cachep, GFP_NOFS); > + BUG_ON(!new_entry); > new_entry->start_blk = block; > new_entry->group = group; > new_entry->count = count; BUG_ON is good for devel things, but for stable stuff it's better to let somebody know an error occured rather than panic'ing the box. The proper solution would be to do if (!new_entry) return -ENOMEM; or if there is some out: label set ret to -ENOMEM and goto out, whatever is appropriate in the context. Thanks, Josef -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
> BUG_ON is good for devel things, but for stable stuff it's better to let > somebody know an error occured rather than panic'ing the box. The proper > solution would be to do > > if (!new_entry) > return -ENOMEM; > > or if there is some out: label set ret to -ENOMEM and goto out, whatever is > appropriate in the context. Thanks, I don't understand the code around here well. But I think it is not that simple. The "new_entry" is needed to free blocks. If it just returns error, it leaks something. -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Index: 2.6-rc/fs/ext4/mballoc.c =================================================================== --- 2.6-rc.orig/fs/ext4/mballoc.c +++ 2.6-rc/fs/ext4/mballoc.c @@ -4417,6 +4417,7 @@ ext4_mb_free_metadata(handle_t *handle, BUG_ON(e4b->bd_buddy_page == NULL); new_entry = kmem_cache_alloc(ext4_free_ext_cachep, GFP_NOFS); + BUG_ON(!new_entry); new_entry->start_blk = block; new_entry->group = group; new_entry->count = count;
kmem_cache_alloc() error in ext4_mb_free_metadata is not handled. I don't know how to fix it. But I can put BUG_ON to let others know the problem. Cc: Theodore Tso <tytso@mit.edu> Cc: adilger@sun.com Cc: linux-ext4@vger.kernel.org Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> --- fs/ext4/mballoc.c | 1 + 1 file changed, 1 insertion(+) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html