zed: only go up to current limit in close_from() fallback
Consider the following strace log:
prlimit64(0, RLIMIT_NOFILE,
NULL, {rlim_cur=1024, rlim_max=1024*1024}) = 0
dup2(0, 30) = 30
dup2(0, 300) = 300
dup2(0, 3000) = -1 EBADF (Bad file descriptor)
dup2(0, 30000) = -1 EBADF (Bad file descriptor)
dup2(0, 300000) = -1 EBADF (Bad file descriptor)
prlimit64(0, RLIMIT_NOFILE,
{rlim_cur=1024*1024, rlim_max=1024*1024}, NULL) = 0
dup2(0, 30) = 30
dup2(0, 300) = 300
dup2(0, 3000) = 3000
dup2(0, 30000) = 30000
dup2(0, 300000) = 300000
Even a privileged process needs to bump its rlimit before being able
to use fds higher than rlim_cur.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11834