Bug 236179 - Quota on FreeBSD 12.0 is not working with NetApp
Summary: Quota on FreeBSD 12.0 is not working with NetApp
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: Security Team
URL:
Keywords: patch, regression
: 239552 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-03-03 11:32 UTC by j.nethdd
Modified: 2020-06-28 11:00 UTC (History)
9 users (show)

See Also:
lwhsu: mfc-stable12+
lwhsu: mfc-stable11+


Attachments
Our changes for `quota.c` to work around with NetApp mount point. (138 bytes, text/plain)
2019-03-03 11:32 UTC, j.nethdd
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description j.nethdd 2019-03-03 11:32:07 UTC
Created attachment 202519 [details]
Our changes for `quota.c` to work around with NetApp mount point.

We meet a quota problem with NetApp after upgraded system from FreeBSD-11.2 to FreeBSD-12.0.
The quota command in FreeBSD-12.0 returned nothing on any NetApp mount point which works good in FreeBSD-11.2. So we trace the rpc.rquotad packet with tcpdump, and found that the difference is quota of FreeBSD-11.2 sent request of rquota-v1 and FreeBSD-12.0 sent request of rquota-v2. Then we trace the code of quota which is located in '/usr/src/usr.bin/quota/quota.c' to find is there any way to send only rquota-v1 request or resend rquota-v1 request after failure of rquota-v2 request. We found that quota will try rquota-v1 if the v2 request return "Program Version Mismatch", but NetApp seems have a non-standard behavior that would response "Program Not Registered" and leads quota exit without re-trying  v1 request.

Link below is the issue of libtirpc on Linux caused by the same non-standard behavior:
https://sourceforge.net/p/libtirpc/mailman/message/36337416/

We patch one line code and it works on our environment for temporary. The diff output of our patch is attached in the letter.

We wonder if this patch can be merged into FreeBSD-12.0, or is there any solution can force quota to use rquota v1 (add an option for this, maybe?) Because NetApp does not want to fix this behavior since 2008, we want to find some solution from FreeBSD.

Regards,
Jian-Bo Liao
Teaching Assistant
MAIL: jbliao@cs.nctu.edu.tw
Computer Center, Department of Computer Science,
National Chiao Tung University, Taiwan.
1001 University Road, Hsinchu, Taiwan 300, ROC.
Comment 1 Sean Eric Fagan freebsd_committer freebsd_triage 2019-03-12 07:40:54 UTC
The patch seems reasonable but I have no way to test it myself, other than build-testing.
Comment 2 j.nethdd 2019-04-25 13:47:50 UTC
Any updates?
Comment 3 Tzu-Te Kuo 2019-05-08 04:54:23 UTC
(In reply to Sean Eric Fagan from comment #1)

How can we provide the test cases?
Comment 4 Tzu-Te Kuo 2019-05-08 05:01:57 UTC
This issue also happened on 11.3 SNAPSHOT since 11.3 starting using rquota v2 and not fallback to v1 while service is responding "Program Not Registered".
Comment 5 Li-Wen Hsu freebsd_committer freebsd_triage 2019-09-14 00:25:04 UTC
hrs: ping? Can we squeeze this into 12.1?
Comment 6 commit-hook freebsd_committer freebsd_triage 2019-09-21 00:17:58 UTC
A commit references this bug:

Author: hrs
Date: Sat Sep 21 00:17:40 UTC 2019
New revision: 352567
URL: https://svnweb.freebsd.org/changeset/base/352567

Log:
  Add a workaround for servers which respond RPC_PROGNOTREGISTERED
  to a clnt_create() call even when it is actually a program
  version mismatch.

  Normally the server is supposed to return RPC_PROGVERSMISMATCH
  when it supports the specified program but not support
  the specified version.  Some filers return RPC_PROGNOTREGISTERED
  to RQUOTA v2 calls and FreeBSD does not retry with the old
  v1 calls.  This change fixes this failure scenario.

  Submitted by:	Jian-Bo Liao
  PR:		236179

Changes:
  head/usr.bin/quota/quota.c
Comment 7 Hiroki Sato freebsd_committer freebsd_triage 2019-09-21 00:19:53 UTC
Sorry for the delay getting back to this PR.  The submitted fix has been committed and will be merged to stable branches.
Comment 8 Sean Eric Fagan freebsd_committer freebsd_triage 2019-09-21 00:20:18 UTC
AWESOME!
Comment 9 Li-Wen Hsu freebsd_committer freebsd_triage 2019-09-21 00:26:08 UTC
Thanks! Is it possible to also submit a request to merge to releng/12.1 branch?
Comment 10 commit-hook freebsd_committer freebsd_triage 2019-09-21 14:03:57 UTC
A commit references this bug:

Author: hrs
Date: Sat Sep 21 14:03:41 UTC 2019
New revision: 352575
URL: https://svnweb.freebsd.org/changeset/base/352575

Log:
  MFC r352567:

  Add a workaround for servers which respond RPC_PROGNOTREGISTERED
  to a clnt_create() call even when it is actually a program
  version mismatch.

  Normally the server is supposed to return RPC_PROGVERSMISMATCH
  when it supports the specified program but not support
  the specified version.  Some filers return RPC_PROGNOTREGISTERED
  to RQUOTA v2 calls and FreeBSD does not retry with the old
  v1 calls.  This change fixes this failure scenario.

  Submitted by:	Jian-Bo Liao
  PR:		236179

Changes:
_U  stable/12/
  stable/12/usr.bin/quota/quota.c
Comment 11 commit-hook freebsd_committer freebsd_triage 2019-09-21 14:07:01 UTC
A commit references this bug:

Author: hrs
Date: Sat Sep 21 14:06:17 UTC 2019
New revision: 352576
URL: https://svnweb.freebsd.org/changeset/base/352576

Log:
  MFC r352567:

  Add a workaround for servers which respond RPC_PROGNOTREGISTERED
  to a clnt_create() call even when it is actually a program
  version mismatch.

  Normally the server is supposed to return RPC_PROGVERSMISMATCH
  when it supports the specified program but not support
  the specified version.  Some filers return RPC_PROGNOTREGISTERED
  to RQUOTA v2 calls and FreeBSD does not retry with the old
  v1 calls.  This change fixes this failure scenario.

  Submitted by:	Jian-Bo Liao
  PR:		236179

Changes:
_U  stable/11/
  stable/11/usr.bin/quota/quota.c
Comment 12 Hiroki Sato freebsd_committer freebsd_triage 2019-09-21 14:08:29 UTC
MFC to 11 and 12 has been completed.  The merge request for releng/12.1 is waiting for a reply from RE.
Comment 13 Li-Wen Hsu freebsd_committer freebsd_triage 2019-10-17 18:15:59 UTC
How's the status of merging this to releng/12.1?
Comment 14 Xin LI freebsd_committer freebsd_triage 2019-10-27 19:53:52 UTC
(In reply to Li-Wen Hsu from comment #13)
It's too late for 12.1-RELEASE, we will do an EN for this one.
Comment 15 Xin LI freebsd_committer freebsd_triage 2019-10-27 20:26:58 UTC
(In reply to Xin LI from comment #14)
EN ticket created as admbug 942.
Comment 16 Xin LI freebsd_committer freebsd_triage 2019-11-21 07:38:52 UTC
*** Bug 239552 has been marked as a duplicate of this bug. ***
Comment 17 Li-Wen Hsu freebsd_committer freebsd_triage 2020-06-28 11:00:34 UTC
EN announced at:

https://www.freebsd.org/security/advisories/FreeBSD-EN-20:07.quotad.asc