Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp922939rwr; Thu, 27 Apr 2023 09:48:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ede/+xHkm2S/Rsr41aryuEZavzvcqcH9ifaHaxa3iKjNVEi2FBVTpTNNeOevlWtyWbH6X X-Received: by 2002:a05:6a00:1883:b0:63a:fb57:63c5 with SMTP id x3-20020a056a00188300b0063afb5763c5mr2936060pfh.3.1682614095327; Thu, 27 Apr 2023 09:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682614095; cv=none; d=google.com; s=arc-20160816; b=AvTgVzBeyemf+9KGpKVFRobRYiaCkXGgT3LUJE8CoWDmtjZGpr5ZVFpNJPm10o1S2K 0AZlp2z33l5/vucVcY2pmXcNLqanNLbPM9NY1ftF6yHLQ4155RZ8r0c1HWzwd7wxyDuw coL+257u3t6Gg/b78D3pIsNAJLvdscU218DtIuFRRYl/WMxGzEjTXyW/5cymhYnxUU+E 143NwutOcaPo5q/IbbvPRP/7H6jJOMfkBiOmqEqWwczlsNkX8SwVWYygiPrcYffBX0Rd rGZJb6UKwqPieDtzvf1bLtmQAdBjeZOOjOENcWQfuZpRFvVFfU4lGx7B9PDCn1lCUej/ 4WAw== 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:date:dkim-signature; bh=ZIDYYHK5a220p003caPkOGEsHbSQifHb9SY/WPNXVOs=; b=xO/Ns1Kd+gSszgUjZE5Clm5tQTFKiV+8I0BtscS8CSuXg0kIDQu4QRQO6LaQX4bCSz 8U1aEV0nTnS6IBmEYMWd6DWfhcEpTrpTmjcvS58wtSNokH74Bp4RkwmiO3avtZ7dfcE5 gMFBysxGvJg6AiWWi9hfpFtu0bUfV7gEzNR1u33b5MWR2FUlQkBDuvCdwZwg8qqhLea3 yb5xPH6PiFQnMNdr5V8/+Xt7M+SaFIP7DSzAPj4tvQe04rjDD+PieAA2pfm6bN+NBcGR 9n/VNdgKDff4ZU81JRidL5kcW6o/IchUyf/BQsjuqY5ThXEQT9RKGEElWwdu+VSjVDTB PtGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ra9FPE4X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x26-20020aa79a5a000000b0063b78674625si18752134pfj.327.2023.04.27.09.48.03; Thu, 27 Apr 2023 09:48:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ra9FPE4X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S243917AbjD0QV7 (ORCPT + 99 others); Thu, 27 Apr 2023 12:21:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232698AbjD0QV5 (ORCPT ); Thu, 27 Apr 2023 12:21:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D4273C0B for ; Thu, 27 Apr 2023 09:21:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD71F63C3E for ; Thu, 27 Apr 2023 16:21:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEBCFC433D2; Thu, 27 Apr 2023 16:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682612516; bh=AlPlL2WN8U77bcV2QwI4i9S22AkfDR+RGnDs6yrBa5k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ra9FPE4X/HSWMCcHnQye/Er4ASReRPGoU+Jsk8zWPZ1rUfCa3fo6f9CjYFWmj6U+/ M+EiC6K5K5kFKvDXpv2+fBz7QsJxaIDJNkmBVBmyEtIxpf51ZiYX4szyo6xQpAAots S3g0zyq7LGEhtt28wpmT/mEfAE3S1mZo+RNLWThM1G8lGzfGg+qx1ubmJmjSNk/7lZ sNiApWh+gyXSoSfU+qmwhZ52YZGDq/pOK/X2whd1okKkrqJrqdCLKwEfVWP0uCx29i mtJ8Kxl4iQAXZkDeUn4jtbO4iN9nnlnW13bVSPsRqGIQqV9aHNArjVwV6vdjDYHZ/e LKh+UlIaBr/gQ== Date: Thu, 27 Apr 2023 09:21:54 -0700 From: Jaegeuk Kim To: Chao Yu Cc: Yangtao Li , Daeho Jeong , Qi Han , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] f2fs: do not allow to defragment files have FI_COMPRESS_RELEASED Message-ID: References: <20230425164711.19826-1-frank.li@vivo.com> <1a602371-d9b0-7148-c916-a02c40649d53@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1a602371-d9b0-7148-c916-a02c40649d53@kernel.org> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/27, Chao Yu wrote: > On 2023/4/26 0:47, Yangtao Li wrote: > > If a file has FI_COMPRESS_RELEASED, all writes for it should not be > > allowed. > > > > Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE") > > Signed-off-by: Qi Han > > Signed-off-by: Yangtao Li > > Oh, I just see v2. > > Reviewed-by: Chao Yu Applied with using goto for code consistency. + if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { + err = -EINVAL; + goto unlock_out; + } + /* if in-place-update policy is enabled, don't waste time here */ set_inode_flag(inode, FI_OPU_WRITE); if (f2fs_should_update_inplace(inode, NULL)) { @@ -2712,6 +2717,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi, clear_inode_flag(inode, FI_SKIP_WRITES); out: clear_inode_flag(inode, FI_OPU_WRITE); +unlock_out: inode_unlock(inode); if (!err) range->len = (u64)total << PAGE_SHIFT; > > Thanks,