Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1421441rwr; Thu, 27 Apr 2023 18:07:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7CC4O7dwbc/M2t7NFEfhEJt02cKf+4SWKaMDrWqR5GlqG1hBpOkhpjEXK5bGX+dnmcXhaG X-Received: by 2002:a17:90a:4a04:b0:23d:35d9:d065 with SMTP id e4-20020a17090a4a0400b0023d35d9d065mr3283236pjh.48.1682644036762; Thu, 27 Apr 2023 18:07:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682644036; cv=none; d=google.com; s=arc-20160816; b=mufh+Dx99GX8jVMHGfy5Pyl34fIG+vTBRlWYS6Ss5dcazoH7V0ykcXmdHsXlL/60fa LTVi0t0/B3SB4CWbJrzXyrwutWWIhrf6c+IIinpA0iQQm1ScKOTYg+W9Jft8xM0Ko7RP stN0AgCjiJ4vrIyfdFgswtlQpKd6kHYgaM+0qJtBVUgI1QeeY8Kup8pp6TfghAe1d1J4 g5+dYvGC6g3G78THHUvWZmD6TznzlUqZmIMSnBXUaiSumw0EVHSUje48nUcHMGW938U3 FFJM8iuWg/IxERsTCI2MuhtBUuJ6eaIABsCtIHl4PzKi+IMKGEnF9EcqMxlgC5gD1pm2 PaeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=hdzRGtM+jC8Lbk6eCK5xGCp6DOHiVXp1+0Y+GyekVsQ=; b=u4VU8ANJNMAGunJgntTUizHjXcTeI24gFyF7vGvyDqZBqwYHY7+2t4K3sC+Fgu7DcX as/gec8nWfRFr6f16n6VoYq+rL6seeACVkmQWXHMDOjuQMP2tUpT9I9tcVvCmZUjrqIB tUcrFvM2qQ5+8axAeXGwQEpcjS0ziolKT0mtwyjG3ksRngxqMxwJWFuLJAGqBIrjL85H btOoQSbLGO5ohB8mMzWK1iOYkp79UbMUXl/ijCcRtpiaxgkf3w/95o1WrW/bRMHO6Vmq R8cEuNB9mRy72rPDcazHP4yATCHHyZh3dw8r0ohAYBkuKvw0HTD93/uWRbcfqyTBK7E3 LM4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JvDQBwec; 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 nv13-20020a17090b1b4d00b002471f613111si24423906pjb.62.2023.04.27.18.07.04; Thu, 27 Apr 2023 18:07:16 -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=JvDQBwec; 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 S1344349AbjD1BDw (ORCPT + 99 others); Thu, 27 Apr 2023 21:03:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229965AbjD1BDu (ORCPT ); Thu, 27 Apr 2023 21:03:50 -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 303C82684 for ; Thu, 27 Apr 2023 18:03:49 -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 C413A640A4 for ; Fri, 28 Apr 2023 01:03:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA979C433EF; Fri, 28 Apr 2023 01:03:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682643828; bh=MWkTz0nO5y2fvrZumB+rPPskXyiiOksV/05GAaM221g=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=JvDQBwecVOgxkrPwYu+v1ZE2Syz4HWgSmdCkD+mWMa2vI0eHJBgyPn7STtBt1DMHi vm50uKsprJrWXrWT7t92FY0Iz6UWkQH8HBLvDdMZBtWdQdCWPz7XwTE7dHIikf5WrO UfUo/uaw7f+9laePflt8GStAFuBmmWQ10a+mDUtw5I/n2OU5EJ7S++cYZf5tAfh+q6 NRzlby4EDG3FCjvrdlGQBXfpf5zljCqwb1ghR4OciI/DOEfi/sQ/LTl9FR0npNnQ+y mPBWmKROkHoPZ9HsCs6uLwcLp57Mj83FhFaIHUwhmHXk8hKXT1IJgLCxcqH6eRmcDs K4hwbqFLzw6LQ== Message-ID: <20801e51-623c-d2bb-6159-9d6aebc66ca9@kernel.org> Date: Fri, 28 Apr 2023 09:03:45 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v2] f2fs: do not allow to defragment files have FI_COMPRESS_RELEASED Content-Language: en-US To: Jaegeuk Kim Cc: Yangtao Li , Daeho Jeong , Qi Han , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20230425164711.19826-1-frank.li@vivo.com> <1a602371-d9b0-7148-c916-a02c40649d53@kernel.org> From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, 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 2023/4/28 0:21, Jaegeuk Kim wrote: > 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. It makes sense, Reviewed-by: Chao Yu Thanks, > > + 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,