Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp147765pxk; Sat, 29 Aug 2020 20:28:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw45OYTrKDSPH7+tL9mz9sb31Je5Wds4DE/ZAhQm1fWb1H97JD1I41xWV9rJFCLhb4x2Qvj X-Received: by 2002:a17:906:a1c2:: with SMTP id bx2mr6231843ejb.426.1598758083497; Sat, 29 Aug 2020 20:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598758083; cv=none; d=google.com; s=arc-20160816; b=FmYzMXellIydQQtuDTnvDjL/XhbJnVLppba13IVvnFQtWvYt9Wpw8V5TBQPpMdC2+R WRo+0t/EfFSTjZM+OjWy90n4npMMKXb9VsLnU5qUK/GZb8mu+ADK4gSLyOcjqUZBWCid ORtMyGGx7SDp9D7YMnpr7UQpaOu3CJ53eOC7zRCjfSj56SvBfX8MWy/+v3F6h3oCj8vc tTtXpD9k046eDKgIG0G0Eag34nYI5mi30uD0YVruKsUwvhe0+8duZZjgkSo1DgDsHg4S ZzZqGpdjYjLgGAeNqioMpD8qroQIhqrPrYN5g7M/zPFaCvHLra0ehm4nL2rOWDarumZj vM8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature; bh=WwyG8wfl++RUXDrvt+8gzuMtc62f5XcAiEf+rd+R4qE=; b=wPewskUIURt2zZCi97kQH47y8BQdWSjZkIVxvTc7g2/7Acu3bzkpjvurfMZR7uCiBK IpVTI7yN92hq5Ggjt0rY7wflkhznIMnkLxcGe0+LOPw2vsw4r2dcpMsd7GyZrafFZ/K6 WyrRjuRcZj448fSee8aptRdCabTi2nwk3jL9femHt3wYBMHbv8hKGM06RlDhwSlvuHmx HZpqwevmxih7ZG7V13QsFC7NWi57cB5KeNM+bs06pkPBcCnTjFmq8A71/RrK0jt6Pw3M Rqju9H5yVqgOdMm7awCrYshoq9jE21LfKM0MxJx4HIafVbb5cpQSBM6IcWvZUNoTyO3N HwDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="p/mC+Ogx"; 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 i16si2818780edb.5.2020.08.29.20.27.41; Sat, 29 Aug 2020 20:28:03 -0700 (PDT) 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=default header.b="p/mC+Ogx"; 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 S1728628AbgH3DYE (ORCPT + 99 others); Sat, 29 Aug 2020 23:24:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:50798 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728613AbgH3DYD (ORCPT ); Sat, 29 Aug 2020 23:24:03 -0400 Received: from [192.168.0.108] (unknown [49.65.245.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9A338204FD; Sun, 30 Aug 2020 03:24:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598757843; bh=T/YuBD9FNEDuwJiC7R7sKn8AsKAtuYVwKij2Pn0fWTM=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From; b=p/mC+Ogx3eCpOFDT4IT3ER5zJKpGtqdpOu7fPod1/pNAXFHPkl4Vdc3fO+ZkBqDQX +ebz0UReH3rWnk18Y2DUvX7IXM8J23BO+lnm3B07NUlhyS+tuX24uaiGA5zR3e4WZ2 0OxxsqwJ7ONdWzykp/KbMARI/f3/Lxx9aCBjJRyU= Subject: Re: [f2fs-dev] [PATCH] f2fs: prevent compressed file from being disabled after releasing cblocks To: Daeho Jeong , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com References: <20200828054629.583577-1-daeho43@gmail.com> Cc: Daeho Jeong From: Chao Yu Message-ID: <61996dcd-6db1-13fc-8239-7e684f3ec49e@kernel.org> Date: Sun, 30 Aug 2020 11:23:49 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20200828054629.583577-1-daeho43@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-8-28 13:46, Daeho Jeong wrote: > From: Daeho Jeong > > After releasing cblocks, the compressed file can be accidentally > disabled in compression mode, since it has zero cblocks. As we are > using IMMUTABLE flag to present released cblocks state, we can add > IMMUTABLE state check when considering the compressed file disabling. > > Signed-off-by: Daeho Jeong > --- > fs/f2fs/f2fs.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index 02811ce15059..14d30740ba03 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -3936,6 +3936,8 @@ static inline u64 f2fs_disable_compressed_file(struct inode *inode) > if (!f2fs_compressed_file(inode)) > return 0; > if (S_ISREG(inode->i_mode)) { > + if (IS_IMMUTABLE(inode)) > + return 1; It looks most of callers are from ioctl, should we add immutable check in f2fs ioctl interfaces if necessary? or I missed existed check. Thanks, > if (get_dirty_pages(inode)) > return 1; > if (fi->i_compr_blocks) >