Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp74314pxu; Thu, 3 Dec 2020 20:05:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLmpIgb5ztUoSbbRwSidGtU+OtsO1mFICekFNgqtiGKfYZo2f7ddRlGmCwsgVZBhT85jd+ X-Received: by 2002:a50:e0c9:: with SMTP id j9mr5784811edl.380.1607054715996; Thu, 03 Dec 2020 20:05:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607054715; cv=none; d=google.com; s=arc-20160816; b=IjKXISKRGZzdr9xWvccB8jV5hjVQiInPXE7MVkNMf3lvOSkH4U7rqvrlr40xah5AtF saIzoOgQUUdr+RQ1qmMcXfxlqbJIfamyMf/1xlZneZklfVdtBP/od7WilhrA1Xr1qSXx D1Obr/n+Wpzug07wGasEQfJXKZrBFHumTX+h0iD2HrmpaZs2fi0eBhZB23aewbAZl95D F10DYqDVIIAD4GoUYQzZznSVAxhhtQgMn+VfcPJXT093C5HYuq9duP+2LK1ZyfMhUNB3 H5om6wvZoyKOAYNhTOZ7FlWxuGq2NJy1ZkNHPelGW0fw2iru7jUPtyCXpG8odZY+tVEO Dq+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=48AvZ7PEKImUMGHBldSjsIFvuxOOtcBCd/Y7TmuHWLo=; b=QXndQgeh2zK2dozKCZTObFJYjk7pOcbCwqhTZYaoTcgn0CRrXz+YVsOvP4KdzaE7Rs crqohEIzAtJbPw6E+iUovUyGLnHwnYqB14g66nBpXabZ6xWv8WXn7iUxIZ0PhAV/i2+K K1QidvJU3vDwVF5qd5iPjiucbMQHFw7MI3bg8tQnA/rm8i+49Zz7tf9UtlOmqaUbplT1 a0xR8NkuxrQY1xK0hKCN5D3UW8AOcbmxPtwY5je4cxePwLJkNkYlT+mtCOWad1Uazr5C 5j2lEwv+BluimMu3DzFi60s6s7yjn/w3idwnxSZUD4rje2LMTp9/cPiL32LiEETU3zDQ h/Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bsJhD0lE; 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 t26si629770eji.212.2020.12.03.20.04.53; Thu, 03 Dec 2020 20:05:15 -0800 (PST) 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=bsJhD0lE; 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 S1726844AbgLDEC2 (ORCPT + 99 others); Thu, 3 Dec 2020 23:02:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:57806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726038AbgLDEC2 (ORCPT ); Thu, 3 Dec 2020 23:02:28 -0500 Date: Thu, 3 Dec 2020 20:01:45 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607054507; bh=DcfkWsDbsf/JOEQ79AZ1Kv2EVoF9gtQ63C/irFhCC60=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=bsJhD0lEDweOLSefcJ+JBO59ev7ZiiljHLUPejv44ascpkB9kMvOsTtR6vDlHT/zF sSlYCgX3qzDfw+z4LsfYuI4ymFm3g3SGXWcgvOVmabjVRd5YBYhM31iwRxuemztw7J dv9C3i/ZC1PnP9/T8KfEOgHwhi13sMSLTtYyGQYVOFx+U9hrI2V39iVogAqZM5t6dM jmXJPqAHUVWC0PYnRciyfXLPFFUWrZEUiRAMAw/e0Z67phzdQAyNFcWWH8k5AjHFKo Snwqpbn7+jcPiUv1xfAgTpmS/LHVZeiVEEbQJ+bplOGGELryNjGfVKWm+FhF9q0h+S LtZeMi/ZXervg== From: Eric Biggers To: Daeho Jeong Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong Subject: Re: [f2fs-dev] [PATCH] f2fs: fix race of pending_pages in decompression Message-ID: References: <20201204005847.654074-1-daeho43@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 04, 2020 at 12:43:23PM +0900, Daeho Jeong wrote: > STEP_VERITY is enabled by f2fs_need_verity() and the function is like below. > We already know the second condition (idx < DIV_ROUND_UP...) is > satisfied when invoking f2fs_alloc_dic(). > > static inline bool f2fs_need_verity(const struct inode *inode, pgoff_t idx) > { > return fsverity_active(inode) && > idx < DIV_ROUND_UP(inode->i_size, PAGE_SIZE); > } Are you sure? I thought that compression (and encryption) apply to the whole file, including any Merkle tree blocks past i_size. Also, even if you include the i_size check, it's still wrong to check fsverity_active() in the middle of the I/O because FS_IOC_ENABLE_VERITY can execute concurrently, causing fsverity_active() to return false at the beginning of the I/O and true later in the I/O. It needs to be checked only once, at the beginning... - Eric