* tirpc/misc/portable.h && src/svc_internal.h now include a new file
  os_epoll.h
  This is so the bsd_epoll.h file can be used untouched exactly as it
  is used in the other projects. eg. osc-osd.

* os_epoll.h is a simple switch between sys/epoll.h on Linux and
  misc/bsd_epoll.h on Kevent systems (FreeBSD based)

* "Roman Divacky" epoll.h file is removed, and is replaced by a very
  similar but different header authored by yours truly.

* The new Header does not have the __packed BUG

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>
In src/svc_internal.h there was an attempt to do an epoll_create
with the new EPOLL_CLOEXEC flag, but in a backward compatible way
so if the system does not supports this flag the old epoll_create()
is used.

But at the end the new epoll_create1 was never called and the new
@flags param was just stuffed into the old unused (never used)
@size param.

So fix by calling the proper epoll_create1, if available.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Matt Benjamin <matt@linuxbox.com>
SVCXPRT refcounting (lifecycle).

Add SVCXPRT lifecycle operations (SVC_REF, SVC_RELEASE) to
exported interface.

On creation, SVCXPRTs have refcnt 1.  Insertion on event
channel counts as 1 ref.  A ref is taken internally -before-
invocation of xp_getreq, the callout is responsible to
call SVC_RELEASE when finished with xprt in the getreq
call path.

Refactor SVC_RELEASE, SVC_DESTROY.

Remove unregistration logic in SVC_RELEASE implementations,
which was not correct.  Meanwhile cause SVC_DESTROY to
unregister unconditionally.

Add remarks on future lock reordering options.

Fix lock ordering violation in svc_xprt_set path.

Finalize xprts in SVC_DESTROY.

Move svc_rqst_finalize_xprt to SVC_DESTROY.  There's no
need for idle processing on destroyed connections.

In addition, remove incorrect conditional cleanup code from
svc_clean_idle2_func.  The "destroyed" case may now be
impossible to hit--log for debugging.

Add missing SVC_REF in svc_rqst_evchan_reg.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>

SVC_REF drops xprt->xp_unlock (don't do it again).

Remove cond_(un)block_events_svc.

These are not called, and disappear in duplex-9.

Remove non-effective duplex cases in clnt_vc.c.

These features are completely redesigned on duplex-9, and
have no real effect here.  Removing the event-blocking
calls is helpful for debugging with helgrind/drd because
it removes a lock order false case.

Hide and rename svc_rqst_(un)block events.

These routines are not just internal helper routines.
To permit declaring these static, also move the
xprt_(un)register routines into svc_rqst.c.

Remove dead code in xprt_register.

Fix call to svc_rqst_unhook_events (missed in commit).

Don't directly decrement refcnt in SVC_DESTROY.

In brief, this is now accounted for.  Internal references are
still returned indirectly, of course.

In addition, add a guard.

Refcnt tracing.

This logic will likely be reduced or removed after further
validation.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Refactor xprt refcnt.

Split lifecycle ops for rendezvous and request xprt handles.
Refactor.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Take xd->refcnt only on new link.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Dont return ref not taken.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Always return SVCXPRT handles ref'd.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
s/__rpc_client/rpc_client/

Consumers understand that they should use the canonical
type name.  Mirrors prior SVCXPRT change.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix uninitialized access, return type of svc_vc_ref.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Normalize CLNT refcouting.

Reimplement CLNT handle refcnting logic to match SVCXPRT.  In
support of this, add cl_lock and cl_flags members to struct
rpc_client.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
On (xp|cl)_destroy, shared destroy only if both refcnts are
now 0.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix unlock typo.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Decrement xd->refcnt only in svc_vc_destroy.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Deal cleanly with bidirectional timeouts.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix rpc_dplx_rec refcnt imbalance.

Each of CLNT and SVCXPRT handle count toward the refcnt, if
present.  Release each such ref in vc_shared_destroy.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Add new file os_epoll.h to Makefile.am

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Add auth-private data to struct svc_req, use in svc_auth_gss.

New auth-private data members added to struct svc_req.  Used
in svc_auth_gss to pass sequence number.

Nb., window logic not final.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Re-implement KRB5 PAC handling.

Do nothing unless the local GSSAPI provider supports
gss_get_name_attribute.  If so, get all known PAC attributes,
and release when other gss data is cleaned up.

We do nothing with this information, but a server such as
Ganesha can decode or use the data if interested.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Remove preprocessor around PAC processing.

MIT just needed gssapi_ext.h.  For now, I think we can count
on a modern GSSAPI.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>
Fix inout parameters for gss_get_name_attr.

Signed-off-by: Matt Benjamin <matt@linuxbox.com>