NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/48879: libquota in threaded programs

>Number:         48879
>Category:       lib
>Synopsis:       libquota in threaded programs has problems
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 06 12:25:00 +0000 2014
>Originator:     Martin Husemann
>Release:        NetBSD 6.99.41
The NetBSD Foundation, Inc.
System: NetBSD 6.99.41 NetBSD 6.99.41 
(GENERIC) #75: Wed May 14 13:08:11 CEST 2014
Architecture: x86_64
Machine: amd64

When doing automatic test runs on diskless machines (with an NFS server w/o
quotas configured), lots of tests fail like this:

Test case: fs/ffs/t_getquota/get_be_1_both

Duration: 6.538409 seconds
Termination reason

FAILED: atf-check failed; see the output of the test for details
Standard output stream

Executing command [ newfs -q user -q group -B be -O 1 -s 4000 -F fsimage ]
Executing command [ /usr/tests/fs/ffs/h_ffs_server -b fsimage unix://test ]
Executing command [ env LD_PRELOAD=/usr/lib/ 
RUMPHIJACK=vfs=getvfsstat,blanket=/mnt quota -u -v ]

Standard error stream

Fail: stderr not empty
--- /dev/null   2014-05-06 14:43:04.000000000 +0000
+++ /tmp/check.08212a/stderr    2014-05-06 14:44:33.000000000 +0000
@@ -0,0 +1,2 @@
+quota: /: quota_get (objtype 0): Result too large or too small
+quota: /: quota_get (objtype 1): Result too large or too small

The exact path of failure is a bit tricky, but the net effect is simple:
libquota uses rpc calls, libc is compiled with _REENTRANT defined, while
libquota is compiled without it being defined.

Now when the quota query rpc fails, clnt_com_create() sets 
rpc_createerr.cf_stat to RPC_PROGNOTREGISTERED. It uses the _REENTRANT version
of rpc_createerr for that.

The caller sees clntudp_create() returning a NULL pointer and checks the
non-_REENTRANT version of rpc_createerr, and is confused by the failure
without error code. Later a switch for the rpc error code runs into the
"default" case and forces errno to ERANGE.

Use a diskless client with non-quota aware NFS server and do:

cd /usr/tests/fs/ffs/t_getquota && atf-run t_getquota


Not sure if this is the correct fix, but it avoids the problem.

Index: Makefile
RCS file: /cvsroot/src/lib/libquota/Makefile,v
retrieving revision 1.10
diff -u -r1.10 Makefile
--- Makefile    21 Mar 2012 05:37:43 -0000      1.10
+++ Makefile    6 Jun 2014 12:09:25 -0000
@@ -8,6 +8,8 @@
 LIBDPLIBS+=     rpcsvc  ${.CURDIR}/../librpcsvc
 SRCS+= quota_open.c
 SRCS+= quota_schema.c
 SRCS+= quota_get.c quota_put.c quota_delete.c

Home | Main Index | Thread Index | Old Index