zfs_onexit_fd_hold: return EBADF even if devfs_get_cdevpriv gave ENOENT
/dev/zfs always has per-open data, so when it is missing the file descriptor is for some other file. Returning ENOENT in this case is confusing as a variety of other conditions (like a missing dataset) may result in the same error. It's better to consistently return EBADF for any problems with the file descriptor. Note that zfs_onexit_fd_hold() is used with 'automatic cleanup fd' - when that fd is closed, typically because a process is terminated, some cleanup action is taken by ZFS driver. E.g. a temporary snapshot hold is released. Perhaps, it would even be worthwhile changing devfs_get_cdevpriv() to return EBADF if there is no associated data. Differential Revision: https://reviews.freebsd.org/D2370 Reviewed by: delphij, smh MFC after: 12 days
This commit is contained in:
parent
05965f3d9f
commit
879cb055bd
@ -137,7 +137,7 @@ zfs_onexit_fd_hold(int fd, minor_t *minorp)
|
||||
*minorp = (minor_t)(uintptr_t)data;
|
||||
curthread->td_fpop = tmpfp;
|
||||
if (error != 0)
|
||||
return (error);
|
||||
return (SET_ERROR(EBADF));
|
||||
return (zfs_onexit_minor_to_state(*minorp, &zo));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user