svn commit: r199617 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Fri Nov 20 22:22:53 UTC 2009


Author: kib
Date: Fri Nov 20 22:22:53 2009
New Revision: 199617
URL: http://svn.freebsd.org/changeset/base/199617

Log:
  On the return path from F_RDAHEAD and F_READAHEAD fcntls, do not
  unlock Giant twice.
  
  While there, bring conditions in the do/while loops closer to style,
  that also makes the lines fit into 80 columns.
  
  Reported and tested by:	dougb

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Fri Nov 20 21:21:13 2009	(r199616)
+++ head/sys/kern/kern_descrip.c	Fri Nov 20 22:22:53 2009	(r199617)
@@ -718,14 +718,15 @@ kern_fcntl(struct thread *td, int fd, in
 			do {
 				new = old = fp->f_flag;
 				new |= FRDAHEAD;
-			} while (atomic_cmpset_rel_int(&fp->f_flag, old, new) == 0);
+			} while (!atomic_cmpset_rel_int(&fp->f_flag, old, new));
 readahead_vnlock_fail:
 			VFS_UNLOCK_GIANT(vfslocked);
+			vfslocked = 0;
 		} else {
 			do {
 				new = old = fp->f_flag;
 				new &= ~FRDAHEAD;
-			} while (atomic_cmpset_rel_int(&fp->f_flag, old, new) == 0);
+			} while (!atomic_cmpset_rel_int(&fp->f_flag, old, new));
 		}
 		fdrop(fp, td);
 		break;


More information about the svn-src-all mailing list