Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4099978pxb; Mon, 30 Aug 2021 19:06:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3pW1gzJmNSvVS68F0pfitsLNn5FUiUKCOoUAygQ3KSPM2V/46kw5GfniZ7RylGcccxM63 X-Received: by 2002:a05:6402:4cd:: with SMTP id n13mr27346384edw.215.1630375567640; Mon, 30 Aug 2021 19:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630375567; cv=none; d=google.com; s=arc-20160816; b=DaeDbMAZZZN1XOW/Hjk1gjtxniGAKfrTuZkJyFC4ZpfYPLPofjVypUCYzHFvaXlkio kYJfPYuh4od8BJ/dbDJe8gUyKRHeRb2nBmxibaTJ+vvTURkz1NdTZPDxGOggstpFgb1Y GCDy56MxzlOgOXihMKGUJvByV3EVsBt8b0BIVFQlVgcf6e9Px8eHaqlniUdbtMGMYcxP AiHhrvONRyUUKaK1R8JW9vtxDu2TBWvRMDk4NYsSDZdAmZdCUCmyIuVFeG0l8ddlZomw vv2m5rpwauL6uEBUWyKv1cSWttvGc4dVrL5AC460coR37S8nTRA7woTqLYZI9mcuqD++ cKWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:dkim-signature; bh=pWz+ELnsmrRFOJr0WkCr9nNG/O8zzC77ngGgyVaPQFs=; b=upjtbAQRd+dTgB/n3qD+2LuYWqChLoSrk1h3uKNM7QbsUC+5LlILFuxn3lgLzyl9Kc uLJE5lScs8rFteKwMWDxalsWiuZRelu+7QnU792Hrz6SUo3/xf7NGCOCWDJ6NA1h+YJ8 2byPErj7xgg2wmwkFYxkcS6Rp420W7LPustoVdnZmoFXEkumbgRHftYIjpZefyWcjO+h 2YT3ij5PCoSWgqn3an8zmz3i7THWUzg/y/js05t3GSDixoWT9o6gWjhZ4756477WldJG elG94dItcxNyrgqmWkgmrqIonQ7aLiOMpOLCmS8Sd+jiYLob0xXq41KRZK0hFnJ0ewE3 wadw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qwtrb9H/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v15si15600137eda.261.2021.08.30.19.05.42; Mon, 30 Aug 2021 19:06:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qwtrb9H/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239378AbhHaCFV (ORCPT + 99 others); Mon, 30 Aug 2021 22:05:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:45864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239356AbhHaCFV (ORCPT ); Mon, 30 Aug 2021 22:05:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 21343600AA; Tue, 31 Aug 2021 02:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630375466; bh=tLp4LG+o8dZOpplbm9O+XCZS+ucavCtGk1I1yTmjv1Y=; h=Subject:To:References:From:Date:In-Reply-To:From; b=qwtrb9H/Ahn+PQZ9nIO7SGw7b07RIau5V+8u5rN47So/2Ti9SBHM+6myyLfYj8xII 2F0Yr2Naq8nfb9wt3WFeOLcLefCs4PEXEb/ngk1HtqbC7Yfl2h0Aw9IpjcgCdTr8or bpBgakK/LcIBpr4a1PnePNU2kbc96E4m/2zAzo1XaN616Nx2qqiV1Mmd4vfpBueui9 fTHaqu+c0u+LxNCYwbMQ+pi2vyngT1KiSRb4BBzNwJWgWgFwK3gvjb3zuhuGf7BW4v CFRdtaR4O5qKjBYpMXzsV8JQ/INzeEyVUvO7cTVegOSynMJdeqMCGO3xG1L0CTeB/F zGTjB6h4lNAyw== Subject: Re: [f2fs-dev] [PATCH 2/2] f2fs: should put a page beyond EOF when preparing a write To: Jaegeuk Kim , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <20210831005346.118701-1-jaegeuk@kernel.org> <20210831005346.118701-2-jaegeuk@kernel.org> From: Chao Yu Message-ID: Date: Tue, 31 Aug 2021 10:04:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210831005346.118701-2-jaegeuk@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/8/31 8:53, Jaegeuk Kim wrote: > 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. > Fixes: a949dc5f2c5c ("f2fs: compress: fix race condition of overwrite vs truncate") > Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks,