From: jing zhang Subject: [PATCH] ext4: BUG_ON could be triggered in ext4_mb_normalize_request() Date: Wed, 7 Apr 2010 21:51:46 +0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Cc: "Theodore Ts'o" , Andreas Dilger , Dave Kleikamp , "Aneesh Kumar K. V" To: linux-ext4 Return-path: Received: from mail-gy0-f174.google.com ([209.85.160.174]:33406 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753355Ab0DGNwF (ORCPT ); Wed, 7 Apr 2010 09:52:05 -0400 Received: by gyg13 with SMTP id 13so558184gyg.19 for ; Wed, 07 Apr 2010 06:52:02 -0700 (PDT) Sender: linux-ext4-owner@vger.kernel.org List-ID: From: Jing Zhang Date: Wed Apr 7 21:34:48 2010 BUG_ON at [line: 2912] could be triggered, if (pa->pa_deleted == 0 && pa->pa_free == 0) as checked at [line: 3111] and [line: 3122]. It is bypassed by adding check for pa_free. Cc: Theodore Ts'o Cc: Andreas Dilger Cc: Dave Kleikamp Cc: Aneesh Kumar K. V Signed-off-by: Jing Zhang --- --- linux-2.6.32/fs/ext4/mballoc.c 2009-12-03 11:51:22.000000000 +0800 +++ ext4_mm_leak/mballoc-16.c 2010-04-07 20:20:26.000000000 +0800 @@ -2901,7 +2901,7 @@ ext4_mb_normalize_request(struct ext4_al if (pa->pa_deleted) continue; spin_lock(&pa->pa_lock); - if (pa->pa_deleted) { + if (pa->pa_deleted || 0 == pa->pa_free) { spin_unlock(&pa->pa_lock); continue; }