summaryrefslogtreecommitdiffstats
path: root/support/nfs/xlog.c
diff options
context:
space:
mode:
authorScott Mayhew <smayhew@redhat.com>2017-08-23 14:57:12 -0400
committerSteve Dickson <steved@redhat.com>2017-08-23 14:58:24 -0400
commit3f46368672ae9e729d012a94db59d04f45cfbc23 (patch)
tree2004c38847594b8003e1a6e9ccfb31867a3ffa7b /support/nfs/xlog.c
parent8aea4a1c1da563437be5a6103ae459045e371f96 (diff)
downloadnfs-utils-3f46368672ae9e729d012a94db59d04f45cfbc23.tar.gz
nfs-utils-3f46368672ae9e729d012a94db59d04f45cfbc23.tar.xz
nfs-utils-3f46368672ae9e729d012a94db59d04f45cfbc23.zip
idmapd: daemonize earlier
daemon_init() calls closeall() to close any "unneeded" file descriptors. This causes the following issue with idmapd on systems that are configured to have SSSD handle local users and groups: 1. During startup, rpc.idmapd calls getpwnam("nobody") and getgrnam("nobody") 2. sss_nss_mc_get{pw,gr}nam from libnss_sss open the cache files for users and groups and store the fd's in a struct sss_cli_mc_ctx. The passwd cache is fd 3 and the group cache is fd 4. 3. idmapd calls daemon_init() which sets fd's 0, 1, and 2 to /dev/null and fd 3 to the write end of the pipe that the child uses to report it's startup status. It then closes all fd's >= 4. 4. idmapd then calls event_init() which leads to epoll_create1() which returns 4 as the epoll fd. 6. An NFSv4 mount request comes in from a client, triggering an nfsdcb callback. 7. idmapd calls getgrgid_r() which leads to a call to sss_nss_check_header() which determines that the cache needs to be reinitialized. sss_nss_mc_destroy_ctx() is called, which closes the ctx->fd which now corresponds to the epoll file rather than the group cache file. 8. event_dispatch() calls epoll_wait() with epfd=4, and -EBADF is returned. idmapd logs the following error and exits with a nonzero status: rpc.idmapd[650]: main: event_dispatch returns errno 9 (Bad file descriptor) Moving the deamon_init() call so that it happens before get{pw,gr}nam() fixes this. Signed-off-by: Scott Mayhew <smayhew@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support/nfs/xlog.c')
0 files changed, 0 insertions, 0 deletions