fd: remove redundant saturation check from fget_unlocked_seq

refcount_acquire_if_not_zero returns true on saturation.
The case of 0 is handled by looping again, after which the originally
found pointer will no longer be there.

Noted by:	kib
This commit is contained in:
Mateusz Guzik 2020-12-16 18:01:41 +00:00
parent 7bd0c4c47d
commit 08241fedc4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=368703

View File

@ -3021,13 +3021,6 @@ fget_unlocked_seq(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
return (error);
#endif
if (__predict_false(!refcount_acquire_if_not_zero(&fp->f_count))) {
/*
* The count was found either saturated or zero.
* This re-read is not any more racy than using the
* return value from fcmpset.
*/
if (refcount_load(&fp->f_count) != 0)
return (EBADF);
/*
* Force a reload. Other thread could reallocate the
* table before this fd was closed, so it is possible