diff options
author | attilio <attilio@FreeBSD.org> | 2008-05-25 14:57:43 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2008-05-25 14:57:43 +0000 |
commit | 4d240aa98e28b74ea9808f1ed3cd852399f4c1ba (patch) | |
tree | efe0ea20cbccbb0a37624368357258c8142915a2 /sys/kern | |
parent | 4789bb571576fe780e5fe461fafb8f80a4f043e1 (diff) | |
download | FreeBSD-src-4d240aa98e28b74ea9808f1ed3cd852399f4c1ba.zip FreeBSD-src-4d240aa98e28b74ea9808f1ed3cd852399f4c1ba.tar.gz |
Replace direct atomic operation for the file refcount witht the
refcount interface.
It also introduces the correct usage of memory barriers, as sometimes
fdrop() and fhold() are used with shared locks, which don't use any
release barrier.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_descrip.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index cbb7653..201d7ca 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1449,9 +1449,9 @@ falloc(struct thread *td, struct file **resultfp, int *resultfd) * descriptor to the list of open files at that point, otherwise * put it at the front of the list of open files. */ - fp->f_count = 1; + refcount_init(&fp->f_count, 1); if (resultfp) - fp->f_count++; + fhold(fp); fp->f_cred = crhold(td->td_ucred); fp->f_ops = &badfileops; fp->f_data = NULL; |