From patchwork Tue Jun 23 19:57:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 179C2C433E1 for ; Tue, 23 Jun 2020 20:56:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D442920656 for ; Tue, 23 Jun 2020 20:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945772; bh=eUKwYhgLO3DTtM512He1RqTz4a4I1dyzOwa/eGBL+7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QAOAgT+esHN+/+P5VzcYKOS2XoZh2pr/Gus9eEYhk4NvTQhvMoJLlSEFjEZarZG+8 CC7xgf07ou0/+YnGBqi2vIjlAfg1Gw9gow9a9YIyitz13W4i72oMOYTIscZCZ9ylO7 0AUa7o/h0zTEyOV0v7rdy9231CYwK5yGzcgz7ygI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390848AbgFWU4L (ORCPT ); Tue, 23 Jun 2020 16:56:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:41026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391736AbgFWUn7 (ORCPT ); Tue, 23 Jun 2020 16:43:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D9CFE2070E; Tue, 23 Jun 2020 20:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592945039; bh=eUKwYhgLO3DTtM512He1RqTz4a4I1dyzOwa/eGBL+7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GjdFVXAoImpLODO740KRmq3Ag9jF1Dmg+fqxFBhra3eCRmWLWIoiExZMcabr6foUJ Z7CoMaJmS01O71KtyusOXl8tbzvhyL11GQb9kn1rFuGNgj24T/LvM5/MR3pQf0TbNt g7fibZ1zIX4ePts9GQjmGsllV6yuQiPva6NQUv9c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konstantin Khlebnikov , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 4.14 016/136] f2fs: report delalloc reserve as non-free in statfs for project quota Date: Tue, 23 Jun 2020 21:57:52 +0200 Message-Id: <20200623195304.433536641@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195303.601828702@linuxfoundation.org> References: <20200623195303.601828702@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Konstantin Khlebnikov [ Upstream commit baaa7ebf25c78c5cb712fac16b7f549100beddd3 ] This reserved space isn't committed yet but cannot be used for allocations. For userspace it has no difference from used space. See the same fix in ext4 commit f06925c73942 ("ext4: report delalloc reserve as non-free in statfs for project quota"). Fixes: ddc34e328d06 ("f2fs: introduce f2fs_statfs_project") Signed-off-by: Konstantin Khlebnikov Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 2d021a33914a6..89319c3524061 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -918,7 +918,8 @@ static int f2fs_statfs_project(struct super_block *sb, limit >>= sb->s_blocksize_bits; if (limit && buf->f_blocks > limit) { - curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits; + curblock = (dquot->dq_dqb.dqb_curspace + + dquot->dq_dqb.dqb_rsvspace) >> sb->s_blocksize_bits; buf->f_blocks = limit; buf->f_bfree = buf->f_bavail = (buf->f_blocks > curblock) ?