From mboxrd@z Thu Jan 1 00:00:00 1970 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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 E5B9DC2D0C2 for ; Fri, 3 Jan 2020 17:12:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF4A8215A4 for ; Fri, 3 Jan 2020 17:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728191AbgACRMQ (ORCPT ); Fri, 3 Jan 2020 12:12:16 -0500 Received: from jabberwock.ucw.cz ([46.255.230.98]:52412 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728207AbgACRMP (ORCPT ); Fri, 3 Jan 2020 12:12:15 -0500 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id D641E1C2461; Fri, 3 Jan 2020 18:12:13 +0100 (CET) Date: Fri, 3 Jan 2020 18:12:13 +0100 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Chengguang Xu , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: Re: [PATCH 4.19 062/114] f2fs: choose hardlimit when softlimit is larger than hardlimit in f2fs_statfs_project() Message-ID: <20200103171213.GC14328@amd> References: <20200102220029.183913184@linuxfoundation.org> <20200102220035.294585461@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TiqCXmo5T1hvSQQg" Content-Disposition: inline In-Reply-To: <20200102220035.294585461@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org --TiqCXmo5T1hvSQQg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Chengguang Xu >=20 > [ Upstream commit 909110c060f22e65756659ec6fa957ae75777e00 ] >=20 > Setting softlimit larger than hardlimit seems meaningless > for disk quota but currently it is allowed. In this case, > there may be a bit of comfusion for users when they run > df comamnd to directory which has project quota. >=20 > For example, we set 20M softlimit and 10M hardlimit of > block usage limit for project quota of test_dir(project id 123). > Signed-off-by: Chengguang Xu > Reviewed-by: Chao Yu > Signed-off-by: Jaegeuk Kim > Signed-off-by: Sasha Levin > --- > fs/f2fs/super.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) >=20 > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index 7a9cc64f5ca3..662c7de58b99 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -1148,9 +1148,13 @@ static int f2fs_statfs_project(struct super_block = *sb, > return PTR_ERR(dquot); > spin_lock(&dquot->dq_dqb_lock); > =20 > - limit =3D (dquot->dq_dqb.dqb_bsoftlimit ? > - dquot->dq_dqb.dqb_bsoftlimit : > - dquot->dq_dqb.dqb_bhardlimit) >> sb->s_blocksize_bits; > + limit =3D 0; > + if (dquot->dq_dqb.dqb_bsoftlimit) > + limit =3D dquot->dq_dqb.dqb_bsoftlimit; > + if (dquot->dq_dqb.dqb_bhardlimit && > + (!limit || dquot->dq_dqb.dqb_bhardlimit < limit)) > + limit =3D dquot->dq_dqb.dqb_bhardlimit; > + > if (limit && buf->f_blocks > limit) { >> blocksize disappeared here. That can't be right. Plus, is this just obfuscated way of saying limit =3D min_not_zero(dquot->dq_dqb.dqb_bsoftlimit, dquot->dq_dqb.dqb_bhar= dlimit)? Best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --TiqCXmo5T1hvSQQg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl4Pde0ACgkQMOfwapXb+vLqwgCfQB23lTPPylgzByCY4o28WHli ZSEAmwVz9M718u4eqzta/6qKREiJLCk4 =iDPi -----END PGP SIGNATURE----- --TiqCXmo5T1hvSQQg--