From 080136212f9b78a35a3cc88dddd70cdfd25201fb Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 20 Nov 2009 22:22:53 +0000 Subject: [PATCH] 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 --- sys/kern/kern_descrip.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 434f54a4dd8..676de650524 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -718,14 +718,15 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) 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;