Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3707266ybv; Mon, 10 Feb 2020 05:04:56 -0800 (PST) X-Google-Smtp-Source: APXvYqxaI3A87J7NjdppsvX+gEMzNNHtH3Kyx5jxuDeE3XuMPlRo+Bd9SujoR9NZ3Y5CCXLrVnug X-Received: by 2002:a9d:6c0d:: with SMTP id f13mr940317otq.354.1581339896217; Mon, 10 Feb 2020 05:04:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581339896; cv=none; d=google.com; s=arc-20160816; b=ai4O7mQsS5wEizO4kyAimhDCYmX2auGBIwHKLE0Yl0JXwKMv5fpZi+z/HCHuCi/V3x LmR7U29sg+FNXTsIox2THsoVXoG7l4JhNn2wvES78ScpCX02aL8/zil8W6P2vuGq0TLR U2vZUCrmjJlTOCnvpJYQgMPV74T4043Is970q0g0ECYYIjriKTK42sjnOHcY4Hg08xTw VUNClJVCcgdAKsVenleCx3hKsxGrymJHW3Gvpdtd138PA6ttT/WB7G5WERe16nt81UTr qCYvom729V8vIcarm1XrWbYvmKXZ6GtoFWYM6MpRbqZLfcQ7sfYf1TPZFj+NtN4zirX8 tX8g== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=odoGFx8eYWv1bR8sK2awzv/zWjUnqoRdhwXjWbAJ60I=; b=JIk0YREOtJy59j1yNGPdV7SvLd3rdPWTQiVJ1/czcrCBeOu47P6lOh6ygRML+MWEvA C4gsVlVUz98Gv4l/oETB56Y0MYg7GtW4NA6WvpGHFXjVx3tIqCdedVyshsdlAr8zPqhq vWaft98FhDzn0hGVdVkq2mgPAtXLNFb0Hq16L7pZJTaH8400ldQMc/zPFO4IUIGGwaHl cGKVX+akUZK8R5kk3sPQh/K24xy6nQENiyvlsD634WQBTNt9qCGfQyy2MOlnaK1n4YIr cE1vZAKyCv7KqcPN8gvYh0UoabS088Jmo61wyYUTyl2fuonhqjv3PQvo0NaAenLRh0l3 NwMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="U/O7Nmz/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m82si130762oig.129.2020.02.10.05.04.43; Mon, 10 Feb 2020 05:04:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="U/O7Nmz/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730116AbgBJNEI (ORCPT + 99 others); Mon, 10 Feb 2020 08:04:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:39962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729683AbgBJMkR (ORCPT ); Mon, 10 Feb 2020 07:40:17 -0500 Received: from localhost (unknown [209.37.97.194]) (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 B04F420838; Mon, 10 Feb 2020 12:40:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338416; bh=c9p7BO+g+O9vu5jRi6Si3qgbX/r1PcAB+5FmIY5Lhy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U/O7Nmz/1SyuGlFWuXhebJWS24305lp0MAaqwc+pDYWCrZIBnT77y7Wvu+lHXhLJz qsXRUyD3zzGH398aWaWMiDVumFfKOvkIpIB9bemvQ/aySDpRzStb49USLhL5jeueNx fg4kslwv49szqaqWvD/EcJQDGa6bPlmgvB3mv7vU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org Subject: [PATCH 5.5 132/367] f2fs: fix miscounted block limit in f2fs_statfs_project() Date: Mon, 10 Feb 2020 04:30:45 -0800 Message-Id: <20200210122437.058285595@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chengguang Xu commit acdf2172172a511f97fa21ed0ee7609a6d3b3a07 upstream. statfs calculates Total/Used/Avail disk space in block unit, so we should translate soft/hard prjquota limit to block unit as well. Below testing result shows the block/inode numbers of Total/Used/Avail from df command are all correct afer applying this patch. [root@localhost quota-tools]\# ./repquota -P /dev/sdb1 --- fs/f2fs/super.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1219,6 +1219,8 @@ static int f2fs_statfs_project(struct su if (dquot->dq_dqb.dqb_bhardlimit && (!limit || dquot->dq_dqb.dqb_bhardlimit < limit)) limit = dquot->dq_dqb.dqb_bhardlimit; + if (limit) + limit >>= sb->s_blocksize_bits; if (limit && buf->f_blocks > limit) { curblock = dquot->dq_dqb.dqb_curspace >> sb->s_blocksize_bits;