fd: switch fget_unlocked to atomic_fcmpset

This commit is contained in:
Mateusz Guzik 2017-02-05 01:40:27 +00:00
parent 1b44f31b19
commit 3a2f282532

View file

@ -2569,8 +2569,8 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
if (error != 0)
return (error);
#endif
retry:
count = fp->f_count;
retry:
if (count == 0) {
/*
* Force a reload. Other thread could reallocate the
@ -2584,7 +2584,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
* Use an acquire barrier to force re-reading of fdt so it is
* refreshed for verification.
*/
if (atomic_cmpset_acq_int(&fp->f_count, count, count + 1) == 0)
if (atomic_fcmpset_acq_int(&fp->f_count, &count, count + 1) == 0)
goto retry;
fdt = fdp->fd_files;
#ifdef CAPABILITIES