From 08241fedc4fa2fe35ee068cdcab6a021c275ecbb Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Wed, 16 Dec 2020 18:01:41 +0000 Subject: [PATCH] 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 --- sys/kern/kern_descrip.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index dbcf6d316a2..aea37d3dfc7 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -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 -- 2.45.0