Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp616998pxk; Sun, 30 Aug 2020 16:44:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpDD6Q2MrXSd+krbWu9eUAPgKFWbDA8cbdKAxMKgH3tQTEtpfg0DJYE63PljExBt5K8UUz X-Received: by 2002:a17:906:813:: with SMTP id e19mr6478228ejd.101.1598831090439; Sun, 30 Aug 2020 16:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598831090; cv=none; d=google.com; s=arc-20160816; b=IrlEIR4qr6z4Dt/0pFsRORSS1DGWGXRzoC2Cq8AC5n0wHmSJM1GM3qSRcRheZZ1nJi pMNH+tHbXYId71Uth/83MFLkgU+yEKPcI/UiJFqF+xciftn/ji2Rd8A0u/WYvLE8ApT8 bhsIKmMRjR6KXnZGXeGrx+94CqYXJhtxJYFDsiRqKOCYzVXh98dxZoJ8vOT5PkK5ESn/ Mt5tfVuIRrnlTJzaW/7QUHRvqGAADeQQ674BlYSJ3OMSItpBnzoWktxrJWsqCS/6xB5k pI0IvXy7WWpUnPllO/F2AlbssiUrjn3PKB/VCJqHKSC69v5C4ZNV40DWn+Su1yWpmZD1 KPqg== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=bWS0GjtZyrC4e/cHEJSl78RSsFz3+ulIrv6l2lk/Cqs=; b=PJQOJAMN2m0yAdOVVh75CVppiT1Fz60IZx/1pW265AF4YPmJ52EziyYCPYDQwLf1Y0 2nH6MKL/o18+6AwdY7LEfbuCfMHhqRQhaMzfjs8jEd2j2uDq7FgLRG9qAwe6RhyKM9mL F954g3yFk8qqEVltz2k9rFyjh/SfXi7C/MswQ5mmdGQHhSvpfxEuGYvcnB0y2gyt+uo4 4YdoDwCjbDWL3qdJqnuZ5QJmwx7JKI0CKqFnRxjmGsvnqXJUhat3dkoibetj5tfO36Xz J/+/saKDovOekimQhFHtJwyFSkO7a363SKI6mR+04k044qxypXJuRpg2m2TGc9IQ8vzB 5TDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OJ4+ifh6; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n23si4719663eja.442.2020.08.30.16.44.26; Sun, 30 Aug 2020 16:44:50 -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=@gmail.com header.s=20161025 header.b=OJ4+ifh6; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726447AbgH3Xms (ORCPT + 99 others); Sun, 30 Aug 2020 19:42:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726388AbgH3Xmr (ORCPT ); Sun, 30 Aug 2020 19:42:47 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88F7EC061573 for ; Sun, 30 Aug 2020 16:42:46 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id u27so1100456lfm.13 for ; Sun, 30 Aug 2020 16:42:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=bWS0GjtZyrC4e/cHEJSl78RSsFz3+ulIrv6l2lk/Cqs=; b=OJ4+ifh6RrIAdM0iJ9Tn/HLFL2d6gFth1jit1w5ol+Km0GmNIGfurjWsGWO/+HCVHP 6Cn2yo7popsZNUQWNsACuea6qHM9eS5a0DVKv1Fozj/s/AZRsiFqwMxp3X1q1VSvIDzT VIl2ZlLRe/IqcT+lEkdXheUAIzGIe+fTBRHiG7wqMhB/SckWPONwVG5xX9nFMgovNEMX LLd4xl/FfUPNsvkq2y2S1e3Nj+P0F+pPIDn+uQEP119LSbzS8f4Q152lxgIuV1hbAv4y /+8CoX9ZcfReFYbauClXnH8Oi1505TNSNWsmfCuuXE+PLEMIfu+iFZMED2YoOnPNNoLs 3Llw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=bWS0GjtZyrC4e/cHEJSl78RSsFz3+ulIrv6l2lk/Cqs=; b=mUzUhmQdyvMEPB38GhCjeR3qAt8kFrNY9MGP9BzegX1OydB8i8CcSoOepl2wr99t2f yD1oYUSbGeHSGmvRg5yZvLOSvm6XpLbbUKJVhuoyjpXqaSI7MqsI5A49/wJ1Lop+ufgs YbKMBTa5siXIyQ9dIi/xsliWnBuPyUf2q7KcDdSjU5Z/XTXUE/fFlt+5JlThjGcqcQFB 0oXhkIJ+jsDTOMXvWH6TQDC9LbeVk3PDi6CfAMA0FgTOY5PLVBtd+mB8vmtXhQo8lI5A yXCObWvPamdB3rc6e7iKx+6AB2RJOk/ur7U6+27K1LHnjV/n39lKzyZvJHRSUTZnqpX0 GaCQ== X-Gm-Message-State: AOAM530kCi2Q+P9DIZJ8R8VkLFyQgiMfkjsy6+XUBipxVEBHKfmEtHCv MC4D/S8CpQ9PY5CYe1MOXeKO0Y332qIrROzET3Y= X-Received: by 2002:a19:ae0a:: with SMTP id f10mr4294068lfc.100.1598830964648; Sun, 30 Aug 2020 16:42:44 -0700 (PDT) MIME-Version: 1.0 References: <20200828054629.583577-1-daeho43@gmail.com> <61996dcd-6db1-13fc-8239-7e684f3ec49e@kernel.org> In-Reply-To: <61996dcd-6db1-13fc-8239-7e684f3ec49e@kernel.org> From: Daeho Jeong Date: Mon, 31 Aug 2020 08:42:33 +0900 Message-ID: Subject: Re: [f2fs-dev] [PATCH] f2fs: prevent compressed file from being disabled after releasing cblocks To: Chao Yu Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do you have any reason not to put this check here? If we do this check outside of here, we definitely make a mistake sooner or later. 2020=EB=85=84 8=EC=9B=94 30=EC=9D=BC (=EC=9D=BC) =EC=98=A4=ED=9B=84 12:24, = Chao Yu =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > 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(st= ruct 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) > >