]> git.proxmox.com Git - mirror_zfs.git/commit
zed: only go up to current limit in close_from() fallback
authorнаб <nabijaczleweli@nabijaczleweli.xyz>
Sat, 3 Apr 2021 10:09:24 +0000 (12:09 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 7 Apr 2021 21:52:51 +0000 (14:52 -0700)
commitc9c6537731d21c00ef5829003db0bb694c6aec56
tree9931b1ad187bca039d7399cd74074d63d7b0b10e
parent509a2dcf7dcff4a44becf2c0ccc4cbf8cd3b72f3
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
cmd/zed/zed_file.c