Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp60792pxu; Thu, 3 Dec 2020 19:32:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJx07qDSfojf9CfxqNqYC0TuWVme/8qF4WqKTNThoJlMqZRUAilXzR5aJ7WOv6TMpKNxPchM X-Received: by 2002:aa7:cd15:: with SMTP id b21mr3345911edw.114.1607052724141; Thu, 03 Dec 2020 19:32:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607052724; cv=none; d=google.com; s=arc-20160816; b=yLvGwjDKNw8OEmDghvJKbcZo+tMeEiP6SfWahaV75gpHuf15yDPYQRhZ5zNr1ROV3n 9nPAQkDEdnKaKa9t2tiYL9ujAvBt2he4gtKsuCf/pd8YEyQBgEnOREJk3s0ayNCT7CIi H7De+KdslE3zTyG+NvmW0WagYPqcJnzPEAyQKB8WqRc+ugeIyb48aZTyoNHEtnJH6Fuy S5YrphACgHnPfUOkuQxG9094ZzNmq9aZhSRyOKPNpKxycXoAiWzitwT2pH6GJTKwAWP7 3kjt34IoRxgVFnpOCwBKW6hZMBEJZWETBwebFVxaLl/jEY5GqhcVLTQKupzcPKzHiqwU uJTw== 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=/TeyZe0/mI0AOkIHZc4rEEZabMAXTNEZFXYNwt0k5Lo=; b=xCXs0onkLOCfH6nxNDUF4U+eZ4R8uvjYIRBvWUfyDv6sVT3UgjfoGTCAO2S7Tvq33b i3teO2X+1xYagkKlrAeCB0Y2TMJ4l3EOVqR93e1Ovh+D1kxOCeVo6hqNsxkdmqfjanZf PAoopNzJFfNBJzo2dXgvwELWF1wS0HdzbZYqc6ej9G+8e6ZtMT7D5uyWrPGrA8UeO/9K cicWWBfYPzWSjlFhqgT5JERaQsr8JyM2rHlnyxrq69kEaorDWlJMSWEoVV08ww8MUpA5 /qAobjfnQzf6f/y/2zUW++0BZflTigIoNS55ljx4v2FkVJYx+t7PZjxU5sE844rR0vB3 1Gjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pLeUlRdA; 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 a13si2066513edb.419.2020.12.03.19.31.40; Thu, 03 Dec 2020 19:32:04 -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=pLeUlRdA; 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 S1727637AbgLDD2y (ORCPT + 99 others); Thu, 3 Dec 2020 22:28:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:45824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726316AbgLDD2y (ORCPT ); Thu, 3 Dec 2020 22:28:54 -0500 Date: Thu, 3 Dec 2020 19:28:11 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607052494; bh=LSn0KRD2PS55Qfjku+L9Oy5ZlN/QdMdDyNZ36/PvM8A=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=pLeUlRdAtr+nikQ+ES2mOIYMNJGkWvOzBmDFyNC892TJlrKZdsVj4vfLcSyJvg9sl BcyeCqHDSNu7rqDCe8wpVvbDXaEYytfQOVerM1PaxTqB7ZvunIovK9FVW2zXMeLwRS 55DIGZbygCp8SkmaB+nUKttwOrSH76v+ZlzBXxTDlCq6gL/ujLCUkQdsvl0jNT09xw Q+3cRlLy9Sx0RNNA26UfSExxx9KyLxeK0qGq28Kfzc+m0ZL7vengtRB2H7fKjS0QOC V6fQ9I94EPQGnrsbVq9SLHda0mkdR+wgljgai4YX5pkcCq6fELK5+ZnGgfdDA5tyGF hOM2/VZSNNOrA== 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: <20201204005847.654074-1-daeho43@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 04, 2020 at 09:58:47AM +0900, Daeho Jeong wrote: > diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c > index 87090da8693d..cdf72e153da0 100644 > --- a/fs/f2fs/compress.c > +++ b/fs/f2fs/compress.c > @@ -803,8 +803,6 @@ void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity) > if (cops->destroy_decompress_ctx) > cops->destroy_decompress_ctx(dic); > out_free_dic: > - if (verity) > - atomic_set(&dic->pending_pages, dic->nr_cpages); > if (!verity) > f2fs_decompress_end_io(dic->rpages, dic->cluster_size, > ret, false); > @@ -1498,6 +1496,8 @@ struct decompress_io_ctx *f2fs_alloc_dic(struct compress_ctx *cc) > dic->magic = F2FS_COMPRESSED_PAGE_MAGIC; > dic->inode = cc->inode; > atomic_set(&dic->pending_pages, cc->nr_cpages); > + if (fsverity_active(cc->inode)) > + atomic_set(&dic->verity_pages, cc->nr_cpages); > dic->cluster_idx = cc->cluster_idx; > dic->cluster_size = cc->cluster_size; > dic->log_cluster_size = cc->log_cluster_size; The check for fsverity_active() is wrong. It looks like you need to know whether the bio needs to go through the fs-verity data verification. The correct way to determine that is to check whether STEP_VERITY is enabled in the bio's bio_post_read_ctx. It's set by f2fs_grab_read_bio() when needed. - Eric