svn commit: r193301 - head/sys/kern
Jeff Roberson
jeff at FreeBSD.org
Tue Jun 2 06:55:33 UTC 2009
Author: jeff
Date: Tue Jun 2 06:55:32 2009
New Revision: 193301
URL: http://svn.freebsd.org/changeset/base/193301
Log:
- Use an acquire barrier to increment f_count in fget_unlocked and
remove the volatile cast. Describe the reason in detail in a comment.
Discussed with: bde, jhb
Modified:
head/sys/kern/kern_descrip.c
Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c Tue Jun 2 05:13:02 2009 (r193300)
+++ head/sys/kern/kern_descrip.c Tue Jun 2 06:55:32 2009 (r193301)
@@ -2075,9 +2075,13 @@ fget_unlocked(struct filedesc *fdp, int
count = fp->f_count;
if (count == 0)
continue;
- if (atomic_cmpset_int(&fp->f_count, count, count + 1) != 1)
+ /*
+ * Use an acquire barrier to prevent caching of fd_ofiles
+ * so it is refreshed for verification.
+ */
+ if (atomic_cmpset_acq_int(&fp->f_count, count, count + 1) != 1)
continue;
- if (fp == ((struct file *volatile*)fdp->fd_ofiles)[fd])
+ if (fp == fdp->fd_ofiles[fd])
break;
fdrop(fp, curthread);
}
More information about the svn-src-head
mailing list