Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp231747ybb; Tue, 14 Apr 2020 23:50:17 -0700 (PDT) X-Google-Smtp-Source: APiQypKTuIdYUdUbmXK0B7m2ZcSlbuUOVOwTLu8hT45spsqLoMI8SNKVyuI4aOp4dzb/3r58CPEG X-Received: by 2002:a50:cd17:: with SMTP id z23mr23079138edi.191.1586933417188; Tue, 14 Apr 2020 23:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586933417; cv=none; d=google.com; s=arc-20160816; b=r+YLPeZHOFzx1+3R2NmfUu8qqUITdfIrcffJ5dlKg8pFrHI8dli/EYcAa41mZinpy6 0bAs+PxOU2bOWO834i9qSZ9VRfhBH4QGoNKLufUR+xSTjo6Xud7u+tnrEuDaWasXSzfW putdhtWTxxnQYq7TRLR3VTKdl74mnPdp8mIRS2WqZTeJPdn3AIwsifUqOFPJLXCei2Bg kvrMkMA8g3s7pcC1X8VPlpEyAPzYi3T/49VOyaXFcVE6muYR7WiKLtGghgcEgPqSXAWh 3jF0Jka+FndpomZmwwoM4RY3ODdMvY5fd/r3wBrhICHrdKzxubWAouvfHId4HvSXUFnQ yJoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=8X5314ZVudzWWx5CnXTyRfo9RywIA7z7l2MOpUpM4TM=; b=RiSGglZY6zlKYFmjA6J1/W7MuJt/v5mIewRDL4eNECF2m51uP7oNjxJ5vOPIp9h6Z9 XXNNQ+THK/KG1NL6duhDiJm6et5n29P2GL/gpxXRbG+p2tRpdovVodqsl60ddV0PB4wu iMluVT+dMe4hKQF6h1BQSkFdyF0Mvs/oGyKfSm9rhnsdShZSrYh2k2drLoawjv5H4sR8 NJo0/eIpdCs6qInruML66e+ejWxOgzSXu153/u24+2LhzIenKPYk79M2p/mLWG5L6GeI S3Yuy1s4b7TVGYsswdgRFJbA1PENhvF98JusbFaqQEI0uo7kN/acjPYrUS4uQxSQ9qmz 68+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w26si1472383eds.605.2020.04.14.23.49.53; Tue, 14 Apr 2020 23:50:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728820AbgDNC2v (ORCPT + 99 others); Mon, 13 Apr 2020 22:28:51 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:46436 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728787AbgDNC2u (ORCPT ); Mon, 13 Apr 2020 22:28:50 -0400 Received: from callcc.thunk.org (pool-72-93-95-157.bstnma.fios.verizon.net [72.93.95.157]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 03E2SlQs007239 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Apr 2020 22:28:47 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id E2ABD42013D; Mon, 13 Apr 2020 22:28:46 -0400 (EDT) From: "Theodore Ts'o" To: Ext4 Developers List Cc: "Theodore Ts'o" Subject: [PATCH] ext4: fix BUG_ON in fs/ext4/page_io.c:ext4_release_io_end() Date: Mon, 13 Apr 2020 22:28:42 -0400 Message-Id: <20200414022842.272657-1-tytso@mit.edu> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The function ext4_release_io_end() can be called by ext4_put_io_end_defer() with the EXT4_IO_UNWRITTEN flag set and io_end->size is 0. In that case, it's safe to release the io_end structure, since if io_end->size is zero, there is no unwritten region to release. This can be reproduced using generic/300, although not very reliably, and almost never using a freshly rebooted kernel. Google-Bug-Id: 15054006 Signed-off-by: "Theodore Ts'o" --- fs/ext4/page-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index de6fe969f773..15125e5b4827 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c @@ -153,7 +153,7 @@ static void ext4_release_io_end(ext4_io_end_t *io_end) struct bio *bio, *next_bio; BUG_ON(!list_empty(&io_end->list)); - BUG_ON(io_end->flag & EXT4_IO_END_UNWRITTEN); + BUG_ON((io_end->flag & EXT4_IO_END_UNWRITTEN) && io_end->size); WARN_ON(io_end->handle); for (bio = io_end->bio; bio; bio = next_bio) { -- 2.24.1