Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp960388pxa; Thu, 27 Aug 2020 22:48:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDkAbB1HjbJlWu4uR0r80Fmfb+l6zxFdK2Sb8iFVz5Ple3DZdK6QBYc5yGz71v6s1BAqR6 X-Received: by 2002:a17:906:2ddb:: with SMTP id h27mr102749eji.203.1598593706612; Thu, 27 Aug 2020 22:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598593706; cv=none; d=google.com; s=arc-20160816; b=WuEDEDIwbHCNoVSxq11MUMCtGKT+SWM9+AkByWxSmH9YQaPCAvna+umugpdRWxxlEr 2qZIpabPm0PBlIuhzONZuonE5MwYZySP3PIvZd9fTs0VuWZ/q8HXC3t/mKqBNAdc0+GO Kz97yPCgLqToZGpzTRKnZjQdb5Vza1l2eWjBKRjyMr92GlcvqHjtFrLwMRP2pqelwGT3 ieqy9SIawC3vd6wawjphO8QZfVDDpsDfPI8MLpzuX+WtdWtivq0I89ZnQ3fbvOKfpH25 zBYscfqv0C+Xt3f8EtMShSoHsxD6Ei9/eHJYdu60VsSOdw8mGEbAHs9+CuJ/IUcLwgb+ 5nNg== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/jRfQwvLhAtFfxvtMX4zIhuTmuddEpLVIB/VUrkOJiQ=; b=XTL9IpFGSEJ/jtaLoRJbxM92q9YMjeBxDdSoeS6872zmbyeBoQSsyN6vEBdQW0HMUF u0Qpyvhd31Doh7edcGyMokgTR380Ov2xLI9tB9+M91liq6w5EKCC1KRi30KGuoiC4Pnz 5HNy74ayWaFtFhRqWhYyS3JlfTnbIrUdd01OINZ1uTTooTR7ymKhsQZQJzNhJknq/fj0 KAL+veFa4ABuSAX/EFOpkX+vx6EonaUV4tV7pqfd5IYMvIFOt25cNG8nYsWck9ejLLH9 7Vlee2MugUADapmfvR9Hh4Kp8TR7ElMcRHVXMxM0E94D6otxa03mP8ItI6DjfobDbxPf AdAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IiWHNQkH; 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 k2si2825850edf.372.2020.08.27.22.48.03; Thu, 27 Aug 2020 22:48:26 -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=IiWHNQkH; 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 S1727054AbgH1Fqo (ORCPT + 99 others); Fri, 28 Aug 2020 01:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725809AbgH1Fqn (ORCPT ); Fri, 28 Aug 2020 01:46:43 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83F61C061264 for ; Thu, 27 Aug 2020 22:46:43 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id g1so4935632pgm.9 for ; Thu, 27 Aug 2020 22:46:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/jRfQwvLhAtFfxvtMX4zIhuTmuddEpLVIB/VUrkOJiQ=; b=IiWHNQkHgZPC0TsBfmFV2AS+Df0EPWPq6l47PKXDOYEfMkf89n+tcSrf6Dj9FuDoFq JjdC38OKwhAsfOQIwPVwJOvagoda+tNnCAN5VuRWLsZPkZWEWLxMEqRzdR2yO9eKq7oR 9gWXu/qcEJaAEKtf9zISVDK6RY4FI9nQcmnC/AgVjxpxB264y6iCcaAui7dkWVTyqC3Y t2dajbRqBYWXntoYCMVsge2zwfs4fv/yQpRIWX9YSjgNA2VmvrFRheART4BjT3RwakMq QW2H09atY0cjCGswRLUM59GgsM8eoOX1SHjFt/9iK3DkwSh3dWQNov9v+Oh6ZE9VL9k2 4jxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/jRfQwvLhAtFfxvtMX4zIhuTmuddEpLVIB/VUrkOJiQ=; b=Mu7UBz14LEBP/nvgebNfqPnepUypM3dxJHTzeg/49sAbrMNAG9Z/3AMsTU0GjR4DQU V+eFKUt7clHCP+PF1WOHa2dWEehF6xmij7NGwC98CkhjeketXBwMCHdn7wb1X5JUJnZh zbV9z9S93y+Zt10N/rBGv4JXmNbPqsl2bRhrJ5XDNyqGduKwCYlUcurgF18lCJ5DT6CT fRBVKmqgWVOVtn+p7xGJQgwJUYWS35IPbqfgI5DdjezhMyU6HXdyZe6roUd3iAlUqio6 uorUUIbHFh+9/0HkiU05PHDz+/PqnkYxL0Ae2L7AkOmqAJSElIsi5t7mFdaGQ06aKrOv gF/A== X-Gm-Message-State: AOAM533V+vlTGLlgzUdgryuc+2n6uQoEW6GCzcTs/yQD8nNy+O2dATre wUOw/R+/tq7JJ15mz6KAXfTvvU0FVZg= X-Received: by 2002:a63:1848:: with SMTP id 8mr16953pgy.347.1598593602391; Thu, 27 Aug 2020 22:46:42 -0700 (PDT) Received: from daehojeong1.seo.corp.google.com ([2401:fa00:d:1:a6ae:11ff:fe18:6ce2]) by smtp.gmail.com with ESMTPSA id y126sm47252pfy.138.2020.08.27.22.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 22:46:41 -0700 (PDT) From: Daeho Jeong To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Daeho Jeong Subject: [PATCH] f2fs: prevent compressed file from being disabled after releasing cblocks Date: Fri, 28 Aug 2020 14:46:29 +0900 Message-Id: <20200828054629.583577-1-daeho43@gmail.com> X-Mailer: git-send-email 2.28.0.402.g5ffc5be6b7-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; if (get_dirty_pages(inode)) return 1; if (fi->i_compr_blocks) -- 2.28.0.402.g5ffc5be6b7-goog