From patchwork Tue Jun 23 19:53:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 223182 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 C78E8C433E0 for ; Tue, 23 Jun 2020 21:22:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A58B420738 for ; Tue, 23 Jun 2020 21:22:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592947347; bh=yrowZCVg6HoJfCL4+N/YgS0sE0XU/a3HglerJdqfvdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=WB2ArIUQ1Ky0jlhSGonHphupwC0CYn9eqMYfhLT09bT7UXn2LTChi9jBk3WN78XAZ +Vo5WTpd0ujarytu70ckkTP8eapeKAEionpmcurroAUCWtq1bvnNtYQBnyQlqXI4Bi 2BSgJlx8Vn5epfA5puhbD5wCfKpc54VsSOttSkG4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390128AbgFWUWI (ORCPT ); Tue, 23 Jun 2020 16:22:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:39948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389004AbgFWUWG (ORCPT ); Tue, 23 Jun 2020 16:22:06 -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 36DFD2070E; Tue, 23 Jun 2020 20:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943726; bh=yrowZCVg6HoJfCL4+N/YgS0sE0XU/a3HglerJdqfvdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wXO9qHv3CGL0hu9lIrJnezkPGQE9N7s5mIBnp5mmaJF6Zzh5BGMlqASgNz6ED8Sk2 jy4w5tWKd8QXJee3/DXiYdxOyXHjRwxKWMYYkXhcV2ZyOPqqw2Zk/elnmEPdrbad1s jQ5LYYsoULAQ7Ti1ZANK0aeDM54kXaK2RNxvpk40= 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.4 026/314] f2fs: report delalloc reserve as non-free in statfs for project quota Date: Tue, 23 Jun 2020 21:53:41 +0200 Message-Id: <20200623195340.056979738@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@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 e36543c9f2b78..d89c85177e092 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1230,7 +1230,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) ?