From patchwork Tue Jun 23 19:50:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223586 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,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 2FE7CC433E0 for ; Tue, 23 Jun 2020 20:03:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0EF172137B for ; Tue, 23 Jun 2020 20:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592942585; bh=r1xtC1sjhUO0eWwH3KhGuQLFsYAjSG/w5CrLHblAEjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=hqfXmKb4T1IX5jkaVj2F9Wr1rv/FTONdkBOefolYkB5tqZK4wDL34dNMgb8Qg6p8v 3VTGT0ubf7jkqoQIhCEowHbySjYOzlLoHIilib23bBSWv9TCzHCjKPvaTyy3BXPiBd HjuSfGOrcak60NGhtw4KIKUF2liowRvmbFIcH+Kg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387948AbgFWUC5 (ORCPT ); Tue, 23 Jun 2020 16:02:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:40386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387946AbgFWUC4 (ORCPT ); Tue, 23 Jun 2020 16:02:56 -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 DD82C2078A; Tue, 23 Jun 2020 20:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592942576; bh=r1xtC1sjhUO0eWwH3KhGuQLFsYAjSG/w5CrLHblAEjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QcDPs4RFc36HItU3w1/5ACqPfxS8G8ZTZ+wugRKgL++5TTjmPqOjEyzAeqrag8n3h FrehNqK1CnYGpBEIhW6xz2ZZAEROtekerDe0GI0Cw6+WDIGFHEio/IzrYWjUj9oih3 7kIGsi06IzWqXSvDVA+LM3ZqfBeJbNtvnGuA2pzM= 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 5.7 035/477] f2fs: report delalloc reserve as non-free in statfs for project quota Date: Tue, 23 Jun 2020 21:50:32 +0200 Message-Id: <20200623195409.260092294@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195407.572062007@linuxfoundation.org> References: <20200623195407.572062007@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 56ccb8323e211..0c88090077fc1 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1303,7 +1303,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) ?