Bug 233849 - r339008 broke repquota on UFS
Summary: r339008 broke repquota on UFS
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 11.2-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Sean Eric Fagan
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2018-12-07 14:07 UTC by Andre Albsmeier
Modified: 2021-01-17 19:19 UTC (History)
9 users (show)

See Also:
koobs: mfc-stable12+
koobs: mfc-stable11?


Attachments
Patch (598 bytes, patch)
2018-12-07 14:07 UTC, Andre Albsmeier
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Albsmeier 2018-12-07 14:07:38 UTC
Created attachment 199932 [details]
Patch

https://svnweb.freebsd.org/base?view=revision&revision=339008
broke repquote on UFS. To fix it, I use attached patch.
Apparently it wants qf->qfname to be filled in by hasquota(). No idea
if calling hasquota() hurts for non-UFS...
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2018-12-07 14:41:59 UTC
Notify committer of r339008.
Comment 2 Sean Eric Fagan freebsd_committer freebsd_triage 2018-12-07 18:18:52 UTC
I saw the original email about the issue, but have not looked any deeply into it yet.
Comment 3 Sean Eric Fagan freebsd_committer freebsd_triage 2018-12-07 19:21:37 UTC
ok.  repquota is going through and reading the quoata file.  Which it can only do on UFS.

There is, as far as I can tell, no problem with checking hasquota() first, although if it returns no error, then there's no reason to call quotactl() afterwards, I think.

This means the code should be moved around and refactored a bit to get the tests done in the right way -- namely, only call quotactl() if hasquota() fails, but fail if quotactl() fails, but also if hasquota() succeeds but it's not UFS. (For now, anyway.)
Comment 4 commit-hook freebsd_committer freebsd_triage 2019-02-07 21:52:03 UTC
A commit references this bug:

Author: sef
Date: Thu Feb  7 21:51:39 UTC 2019
New revision: 343881
URL: https://svnweb.freebsd.org/changeset/base/343881

Log:
  r339008 broke repquota for UFS.  This rectifies that.

  Refactor the function calls and tests so that, on UFS, the proper fields
  are filled out.

  PR:		233849
  Reported by:	Andre Albsmeier
  Reviewed by:	mav, delphij
  MFC after:	1 month
  Sponsored by:	iXsystems Inc
  Differential Revision:	https://reviews.freebsd.org/D18785

Changes:
  head/lib/libutil/quotafile.c
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-02-07 22:11:22 UTC
A commit references this bug:

Author: sef
Date: Thu Feb  7 22:10:21 UTC 2019
New revision: 343882
URL: https://svnweb.freebsd.org/changeset/base/343882

Log:
  r343881 had an uninitialized error.  This fixes that.

  PR:             233849
  Reported by:    Andre Albsmeier
  MFC after:      1 month
  Sponsored by:   iXsystems Inc
  Differential Revision:  https://reviews.freebsd.org/D18785

Changes:
  head/lib/libutil/quotafile.c
Comment 6 Andrey Linkevich 2019-02-28 11:18:01 UTC
Hello

FreeBSD FreeBSD 12.0-STABLE r344111 GENERIC  amd64

We are use groupquota.

repquota return data about only wheel group

# repquota -g /mnt/hosting
                                           Block  limits                    File  limits
User                                  used   soft   hard  grace     used    soft    hard  grace
wheel                            -- 2385444      0      0      -    60633       0       0      -

edquota/quotacheck/quota -gv uses normally.

If yor execute quotaoff -a , everything works fine - repquota return data about all group.

# repquota -g /mnt/hosting
                                           Block  limits                    File  limits
User                                  used   soft   hard  grace     used    soft    hard  grace
wheel                            -- 2385444      0      0      -    60633       0       0      -
operator                         --    192      0      0      -        1       0       0      -
staff                            -- 328876      0      0      -    19568       0       0      -
www                              --   1240      0      0      -       29       0       0      -
mariadb                          -- 3653288      0      0      -      948       0       0      -


Patch https://reviews.freebsd.org/D18785 helped us.

Please commit this in STABLE branche.

Thanks a lot
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-03-11 03:01:03 UTC
A commit references this bug:

Author: sef
Date: Mon Mar 11 03:00:33 UTC 2019
New revision: 344997
URL: https://svnweb.freebsd.org/changeset/base/344997

Log:
  MFC r343881

  r339008 broke repquota for UFS.  This rectifies that.

  Refactor the function calls and tests so that, on UFS, the proper fields
  are filled out.

  PR:           233849

Changes:
_U  stable/12/
  stable/12/lib/libutil/quotafile.c
Comment 8 commit-hook freebsd_committer freebsd_triage 2019-03-11 03:03:10 UTC
A commit references this bug:

Author: sef
Date: Mon Mar 11 03:01:58 UTC 2019
New revision: 344998
URL: https://svnweb.freebsd.org/changeset/base/344998

Log:
  MFC r343882

  r343881 had an uninitialized error.  This fixes that.

  PR:             233849

Changes:
_U  stable/12/
  stable/12/lib/libutil/quotafile.c
Comment 9 lampa 2019-07-16 12:25:26 UTC
Not committed in 11-STABLE, 11.3-RELEASE, repquota doesn't work:

FreeBSD XXX 11.3-STABLE FreeBSD 11.3-STABLE #23 r349909: Thu Jul 11 16:01:04 CEST 2019     

repquota /home
                                           Block  limits                    File  limits
User                                  used   soft   hard  grace     used    soft    hard  grace
root                             -- 836341780      0      0      -    62221       0       0      -


No users reported, only root.
Comment 10 Kubilay Kocak freebsd_committer freebsd_triage 2019-08-19 12:33:41 UTC
Fix committed to head and stable/12

Pending stable/11 MFC

^Triage: Assign to committer resolving
Comment 11 Sean Eric Fagan freebsd_committer freebsd_triage 2019-09-01 21:09:24 UTC
My question is does this need to go into 11/stable?  I don't have the test systems for this any longer, which makes me a bit hesitant, but I can't try to reproduce them.
Comment 12 Philip Petrov 2019-09-02 04:05:20 UTC
I can confirm this bug on my end still exists:

root@srv2:~ # repquota /
                                           Block  limits                    File  limits
User                                  used   soft   hard  grace     used    soft    hard  grace
root                             -- 18505800      0      0      -   843339       0       0      -

root@srv2:~ # freebsd-update fetch
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 11.3-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.

No updates needed to update system to 11.3-RELEASE-p3.

root@srv2:~ # uname -v
FreeBSD 11.3-RELEASE-p2 #0: Tue Aug  6 05:07:20 UTC 2019     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC
Comment 13 Andre Albsmeier 2019-09-02 06:03:09 UTC
> My question is does this need to go into 11/stable? 

Yes.
Comment 14 commit-hook freebsd_committer freebsd_triage 2019-09-03 04:51:04 UTC
A commit references this bug:

Author: sef
Date: Tue Sep  3 04:50:39 UTC 2019
New revision: 351730
URL: https://svnweb.freebsd.org/changeset/base/351730

Log:
  MFC r343881, r343882

  r339008 broke repquota for UFS.  This rectifies that.

  PR:		233849

Changes:
_U  stable/11/
  stable/11/lib/libutil/quotafile.c
Comment 15 Sean Eric Fagan freebsd_committer freebsd_triage 2019-09-03 04:53:47 UTC
Ok, I MFC'd the two patches.
Comment 16 johan liet 2019-10-05 05:08:09 UTC
quotacheck has the same problem. It only works with quotaoff.
Comment 17 johan liet 2019-10-05 11:03:48 UTC
I did the patch for 11.3-RELEASE-p3 on quotafile.c and compiled it, but it still didn't worked.
Comment 18 johan liet 2019-10-06 21:43:50 UTC
The function "quota_maxid" gives a zero in return with quotaon,
but gives the real "maxid" with quotaoff. So there is the bug.
The patch for ufs is useless.
I put temperarely "maxid = 65534;" (nobody) in repquota and quotacheck
And that works.
Comment 19 Alexey Koscheev 2020-02-19 23:19:05 UTC
After upgrade from 11.2 to 11.3-RELEASE-p6 i got same problem on two servers.

I applied patch from here:
New revision: 351730
URL: https://svnweb.freebsd.org/changeset/base/351730

It works!
Comment 20 Philip Petrov 2020-04-25 06:38:35 UTC
11.3-RELEASE-p8 included an update to /usr/src/usr.bin/quota/quota.c but unfortunately it did not resolve the issue.
Comment 21 Alexey Koscheev 2020-04-25 06:47:39 UTC
(In reply to Philip Petrov from comment #20)
Because the problem is in lib/libutil/quotafile.c.

I don't understand, why it takes so long time to close an outright bug.
Comment 22 johan liet 2020-04-25 07:09:58 UTC
(In reply to freebsd from comment #21)
Because people forget to compile  both /usr/src/lib/libutil/quotafile.c AND
/usr/src/usr.sbin/repquota/repquota.c or else the patch doesn't work.
The issue has been solved months ago. Update it with freebsd-update.
Comment 23 Alexey Koscheev 2020-04-25 12:00:22 UTC
(In reply to johan liet from comment #22)
This(In reply to johan liet from comment #22)
Fix only in STABLE.
Comment 24 johan liet 2020-04-25 13:38:17 UTC
(In reply to freebsd from comment #23)
There was a freebsd-11.3 update  for repquota on 4 Oct 2019 on the release branch.
Wasn't that the bug fix ?
Comment 25 Alexey Koscheev 2020-04-25 13:52:35 UTC
(In reply to johan liet from comment #24)
No.
Comment 26 johan liet 2020-04-25 14:07:09 UTC
(In reply to freebsd from comment #25)
Then you have to compile the source like I said in comment 22
or upgrade to Freebsd-release-11.4. Release 11.3 will be end of life over 2 months.
I am not a maintainer so that's all I can tell you about repquota.
Comment 27 Alexey Koscheev 2020-04-25 14:27:51 UTC
(In reply to johan liet from comment #26)
I build kernel and world from source, so get the patch from STABLE is not problem for me.

11.4 is not released yet.
Comment 28 johan liet 2020-04-25 14:55:50 UTC
(In reply to freebsd from comment #27)
release 11.4 is about to be released or upgrade to release-12.1
As a last solution you can download my repquota from
 
http://homeunix.nl/downloads/repquota
it is a ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 11.3, FreeBSD-style, stripped
Comment 29 Alexey Koscheev 2020-04-25 15:18:14 UTC
(In reply to johan liet from comment #28)
I don't need this.
And your file is useless, because problem in /lib/libutil.so.9 :)
Comment 30 Philip Petrov 2020-04-25 15:23:55 UTC
(In reply to johan liet from comment #28)

This is not helping and fixing the issue.
Comment 31 johan liet 2020-04-25 17:04:59 UTC
(In reply to Philip Petrov from comment #30)
Last time, then I give up.

remember. it is a 32 bit executable

/lib/libutil.so.9: ELF 32-bit LSB shared object, Intel 80386, version 1 (FreeBSD), dynamically linked, stripped

http://homeunix.nl/downloads/libutil.so.9
Comment 32 Alexey Koscheev 2020-04-25 17:13:54 UTC
(In reply to johan liet from comment #31)
No one in their right mind will download binary files from an unknown source.
Sorry.
Comment 33 johan liet 2020-04-25 17:26:53 UTC
(In reply to freebsd from comment #32)
Shure, I am subscribed to this bug list and try to help you the last 4 hours
just to hack your computer. Have a good day.
Comment 34 Alexey Koscheev 2020-04-25 17:40:14 UTC
We just want the fix will appear in RELENG.
Comment 35 Ed Maste freebsd_committer freebsd_triage 2021-01-17 19:19:27 UTC
The fix should be available in all supported releases; please re-open with details if this is not the case.