Fix CID_67152: Self assignment  (NO_EFFECT)
Fix DisplayLogComponentLevel recursion with NIV_FULL_DEBUG

If ganesha is started with NIV_FULL_DEBUG, DisplayLogComponentLevel
calls PTHREAD_RWLOCK_xxx() functions which call DisplayLogComponentLevel
to log messages. This continues in a loop until segmentation fault
happens!  A regression introduced by commit
344de4ab632713145194e936a8fb3568b9538321

Redefine PTHREAD_RWLOCK_xxx macros in logging file to avoid logging
inside PTHREAD_RWLOCK_xxx macros.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Reported-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-by: Frank S. Filz <ffilzlnx@mindspring.com>
Fix errno 34 (ERANGE) with getgrouplist() call

The first getgrouplist call with 0 ngroups returns -1 as the man page
says, but errno was set to 34 (instead of 0) under some environments.
The man page doesn't talk about errno with regards to getgrouplist call.
It did set the ngroups to the expected value!

Removed the errno check with getgrouplist call. The code assumes that
ngroups is set correctly no matter what the errno value is.

Reported-by: John Dorfner <dorfner@us.ibm.com>
Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Jim Lieb <jlieb@panasas.com>
Reviewed-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
Fix getgrouplist race

We make first getgrouplist() call with 0 ngroups to get the number of
groups the user is in. We then make the second call with just enough
memory to hold returned ngroups from the first call. If someone adds the
user to a new group between those two calls, both calls will fail!

This commit adds a third call with the largest ngroups we support (1000)
to make the third call. We resize the buffer after the call to just fit
the returned ngroups.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Reviewed-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Acked-by: Frank S. Filz <ffilzlnx@mindspring.com>
CID30206: fix locking issue in nfs41_foreach_client_callback
Need to asynchroniously invoke client callback to
avoid releasing lock while traversing the nsm client RBT tree.

Signed-off-by: Rong Zeng <rongzeng@us.ibm.com>
Contrib: Fix compile for both <= RHEL6 and current distros

Switch Fedora 15 and later.

Signed-off-by: Jim Lieb <lieb@sea-troll.net>
Enlarge VFS_MAX_HANDLE to 48 to allow room for panfs handles

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Remove dead code in common_utils.c

Signed-off-by: Jim Lieb <lieb@sea-troll.net>
Deprecate common_utils.c

The only two functions left were only used by the handle mapping db code
in PROXY.  Move them there and get rid of the rest.

Signed-off-by: Jim Lieb <lieb@sea-troll.net>
Fix config parsing for PROXY

Signed-off-by: Jim Lieb <lieb@sea-troll.net>
Remove release_export_serializer

This really doesn't accomplish anything, go ahead and remove it.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Clean out some dead code

Signed-off-by: Jim Lieb <lieb@sea-troll.net>
Fix error message to be less alarming and more informative

Signed-off-by: Jim Lieb <lieb@sea-troll.net>
9P: fixes bug related to op_ctx management in 9p.

Signed-off-by: Philippe DENIEL <philippe.deniel@cea.fr>
idmapper nfs4_gss_princ_to_ids fix:
idmapname2id() is called in case of name to id mapping.
This calls the nfs4_name_to_uid() API.

On success from nfs4_name_to_uid(), we again try to get id,
this time treating the username as kerberos principal.
This calls nfs4_gss_princ_to_ids() which is incorrect.

Removed the call nfs4_gss_princ_to_ids() from idmapname2id().

Reported-by: John Dorfner <dorfner@us.ibm.com>
Signed-off-by: suhrud <supatank@in.ibm.com>
Group-id bit check in ACE flag

check for specific bit instead of comparing complete number.
Ported from 1.5 : commit 44870c76b1950f85e3a2bc6b59a516993ed801a5

Signed-off-by: suhrud <supatank@in.ibm.com>
Encoding GROUP@ name in ACL
The code does not check if the group id is special id.
This leads to mapping the special "GROUP@" name to system gid 2.
Fixed to first check for special id while encoding the group name

Ported from 1.5: commit d3a14b898804585f2f594a0e4f6736769fad878d

Signed-off-by: suhrud <supatank@in.ibm.com>
idmapper collision fix

The threads that lookup by name or id use the read lock. If they don't
find an entry, then they release the read lock, acquire the write lock
and then add the entry. So it is possible that multiple threads may fail
to find an entry at one point and they all try to add. In this case, we
will be trying to insert same name,id mapping. It is also possible that
name got a different id or an id got a different name causing us to find
an existing entry when we are trying to add an entry! So collison
warning log message is incorrect!

Removed the collision warning log message. Re-arranged the code to make
it a bit more readable. Also added in_uidtree boolean field in struct
cache_user to avoid removing a node entry without actually inserting one
before!

Reported-by: John Dorfner <dorfner@us.ibm.com>
Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Verify the node we find in the hash arrays

Verify that the node we find in uid_cache and gid_cache arrays is in
fact what we need.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Acked-by: Suhrud Patankar <supatank@in.ibm.com>
Fix incorrect use of atomic_[store/fetch]_uint64_t

atomic_store_uint64_t and atomic_fetch_uint64_t were used in idmapper
cache and supplementary groups cache code to store a pointer!  Replaced
those calls with atomic_store_voidptr and atomic_fetch_voidptr
respectively.

Signed-off-by: Malahal Naineni <malahal@us.ibm.com>
Acked-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
Acked-by: Suhrud Patankar <supatank@in.ibm.com>