From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4FA7C4320E for ; Tue, 31 Aug 2021 00:54:02 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97FB260FE6; Tue, 31 Aug 2021 00:54:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 97FB260FE6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1mKs2M-00044s-9n; Tue, 31 Aug 2021 00:54:02 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mKs2K-00044M-6d for linux-f2fs-devel@lists.sourceforge.net; Tue, 31 Aug 2021 00:54:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=66MOhctBohnV7wvCMd1/bq5Lk7HMv2rZhQVVuO0729s=; b=NM8XJARLofFIKyFp1HcmNe9Nih +HHvIYSjb4asf4zjpO0y12//o5bTnpanETnkAgUW140h6LPpxpVEwfeE1Iy0ebocGIBH2xJNSYXZM ZhN49mVytVTyeBAUQXpkH6+5ao2Jv+g04/s2He4IiPs41dlwkAIa2zU+U6E1wot5K16o=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=66MOhctBohnV7wvCMd1/bq5Lk7HMv2rZhQVVuO0729s=; b=IbxUi46V6LOZJLt7HngWQgIoRJ n000Q4TGJbZ4jS6KtQLk/+10IbCW4cQ2KMU+vbubZ2DBEsvF64Jkymf7aQmc+U9kdeOD+emX0lQOc slbv1397vj9Dje8kuu/fWJLpnE7dRO2oPlI9LIq4LZAAuPDCVbdcXQSGwjacwly0KnYs=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) id 1mKs2I-008SkO-G3 for linux-f2fs-devel@lists.sourceforge.net; Tue, 31 Aug 2021 00:53:59 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E499A60FF2; Tue, 31 Aug 2021 00:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630371229; bh=wBfoW5VjwX94tcmf1r6pB9v16U5JrskEzJHYSKjraeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kbsDjgF4iL4PUIHG0HoCvJiey/CrxhSgz64wChmx8LYG+bVhTon7os6IsuNZirvRz YandMPLGIx9SEZvQL8C3AzBJVVCiU/L8U6TSzGZ0LDiiVzWtfcg33ExaBw3MqTRmtn NJP2a8hktUNxs72et2K904CfeaJHLfmcUWrPbg61rMZoG5P0AwK1aU1HN2ALtL5bWp 3fVG20HP+dmaezpLzyvEPZOLDLGmFqXr+4R7uWpidqfDfbOMb3nTGy1lGl8zLt28/9 HX6FPUpdG9SfMCYPznYdh6K8UoebkRyxldHQRHphVsepPRNcYHlPeDcU1KFc4ZYm7v 2MbMVD4/RTmrA== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Date: Mon, 30 Aug 2021 17:53:46 -0700 Message-Id: <20210831005346.118701-2-jaegeuk@kernel.org> X-Mailer: git-send-email 2.33.0.259.gc128427fd7-goog In-Reply-To: <20210831005346.118701-1-jaegeuk@kernel.org> References: <20210831005346.118701-1-jaegeuk@kernel.org> MIME-Version: 1.0 X-Headers-End: 1mKs2I-008SkO-G3 Subject: [f2fs-dev] [PATCH 2/2] f2fs: should put a page beyond EOF when preparing a write X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jaegeuk Kim Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net The prepare_compress_overwrite() gets/locks a page to prepare a read, and calls f2fs_read_multi_pages() which checks EOF first. If there's any page beyond EOF, we unlock the page and set cc->rpages[i] = NULL, which we can't put the page anymore. This makes page leak, so let's fix by putting that page. Signed-off-by: Jaegeuk Kim --- fs/f2fs/data.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 8e8824605f83..41d29382eced 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2183,6 +2183,8 @@ int f2fs_read_multi_pages(struct compress_ctx *cc, struct bio **bio_ret, continue; } unlock_page(page); + if (for_write) + put_page(page); cc->rpages[i] = NULL; cc->nr_rpages--; } -- 2.33.0.259.gc128427fd7-goog _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel