Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7473424rwd; Tue, 20 Jun 2023 01:32:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6QMpmxFtJBDc/YAwB16AWisKvYgnDh9+BtDXPTX+YB5YEDN2hInA/xyAjMlAV5XEBdqx76 X-Received: by 2002:a05:6a20:6a03:b0:10a:eea0:6987 with SMTP id p3-20020a056a206a0300b0010aeea06987mr16623516pzk.26.1687249972197; Tue, 20 Jun 2023 01:32:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687249972; cv=none; d=google.com; s=arc-20160816; b=mn8/LeCu0aM84JL1fqMfoJivCupEXVY4sqylLSK4z/Pr6zeoh6irQAMNbzmcttXqQA G4HR+kY2vco1GAgZJnfdy9d3oIV1UGAWdKG1jYEBmlgn4gf9UePVV7NDTlCwTAYz8yLt SBqBIZQMjiTbhlxO13gohzVeRUrwb6i5eH5uqQzDJIGFOTVMmOpntqDfqdKtRo9WilKp x6McavCsxvXQB0soi8Ko45MNxr/Oi0d4p+dT2oZQ+olkU3784cDHwk6Mz/7kvbLCq2Ax +JjDvtvflGfEU2qg558/k/48c8VjzZUUthiECl98nJDB67WqUt7gogqCUMlX//H/sohY irkQ== 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=Ggfqpg2T6UtHaQ9JI9PXzNWeKnYQrdGsPter6PmcuJ8=; b=JSItS5Rf7NK8Z49hEGV/O8nXYfz23AdFgibI6QXgFGP+RWIhjYpfbkQLqqiQnQxF+L B/a+6B3kW9WCizFlbt5AKdab4XWl3Hvc5miU+iMkW98pk2G1phXkal9v8jXhU9Qna48n xnaINa3G0L5KdQzc93QIzK2scucKW+9giEFijRTjdaczFnCoELSaElTaARRN8LMdd01W fupC7mtthz5/JjanJ3J35GbtOUcG2sXTbmXrvj7iFohXkuAWQl5n8ygXO/0SKGfckGr5 y7py9C9CaMGFk/LKN/AAIX/tu45YKrgla4z6Y1zZ6Z/Uf5DEOT5GMKxW3bIllBTFTeN/ Eo4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JuxQMmRI; 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 w191-20020a6382c8000000b00530b3b98fc5si1241744pgd.417.2023.06.20.01.32.36; Tue, 20 Jun 2023 01:32:52 -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=JuxQMmRI; 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 S230413AbjFTH4n (ORCPT + 99 others); Tue, 20 Jun 2023 03:56:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231717AbjFTH4U (ORCPT ); Tue, 20 Jun 2023 03:56:20 -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 1969F19BA for ; Tue, 20 Jun 2023 00:55:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7BA416101B for ; Tue, 20 Jun 2023 07:54:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 017D7C433C0; Tue, 20 Jun 2023 07:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687247697; bh=sTQUsMU4v3FUIkGlINnBHSs6rd3VGMrSfXMTLhs40+s=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=JuxQMmRIkMUYXmq93mDvU+ISUN6Z5DeSxGGAdHYklBezpATnyIWlA91w021ytW6Dm zNQBBtkH+Oz8NgyOAMV4L6Lq1XVmIQH0/SsDBj7hGCrPHWIzL6zQWYiSMhZjUc3lVS jlmYduvpI9+trGB5plj26kjZRu8yAmomLYG/8cZhegqxZrlq05jMQ361JEm1vKTTDA EzjXJkzLdu/rhFHzrMB13KdRcLFPS4clnIdHCDmEBlDCsub843LSDPisinUEsSS82e tTGxYl+8luutKJEt0JdEzvZSL0VTTx1LNtY+jK1RBcctdDgwFFWAU0lSORr1vuezT8 CmqDI97655yuw== Message-ID: Date: Tue, 20 Jun 2023 15:54:54 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [f2fs-dev][PATCH] f2fs: not allowed to set file both cold and hot Content-Language: en-US To: =?UTF-8?B?5L2V5LqR6JW+KFl1bmxlaSBoZSk=?= , jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20230613085250.3648491-1-heyunlei@oppo.com> <6c527e97-c4a6-dc58-13fb-516f77e5e068@oppo.com> From: Chao Yu In-Reply-To: <6c527e97-c4a6-dc58-13fb-516f77e5e068@oppo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.5 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/6/20 10:42, 何云蕾(Yunlei he) wrote: > > On 2023/6/20 8:33, Chao Yu wrote: >> On 2023/6/13 16:52, Yunlei He wrote: >>> File set both cold and hot advise bit is confusion, so >>> return EINVAL to avoid this case. >>> >>> Signed-off-by: Yunlei He >>> --- >>>   fs/f2fs/xattr.c | 3 +++ >>>   1 file changed, 3 insertions(+) >>> >>> diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c >>> index 213805d3592c..917f3ac9f1a1 100644 >>> --- a/fs/f2fs/xattr.c >>> +++ b/fs/f2fs/xattr.c >>> @@ -127,6 +127,9 @@ static int f2fs_xattr_advise_set(const struct xattr_handler *handler, >>>                  return -EINVAL; >>> >>>          new_advise = new_advise & FADVISE_MODIFIABLE_BITS; >>> +       if ((new_advise & FADVISE_COLD_BIT) && (new_advise & FADVISE_HOT_BIT)) >>> +               return -EINVAL; >> >> Yunlei, >> >> What about the below case: >> >> 1. f2fs_xattr_advise_set(FADVISE_COLD_BIT) >> 2. f2fs_xattr_advise_set(FADVISE_HOT_BIT) > > Hi,  Chao, > >     I test this case work well with this patch,  case below will return -EINVAL: > >     f2fs_xattr_advise_set(FADVISE_COLD_BIT | FADVISE_HOT_BIT) Correct, I missed to check below statement. new_advise |= old_advise & ~FADVISE_MODIFIABLE_BITS; Anyway, the patch looks good to me. Reviewed-by: Chao Yu Thanks,