diff options
author | pjd <pjd@FreeBSD.org> | 2012-06-17 16:32:32 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2012-06-17 16:32:32 +0000 |
commit | 9a81d01ee060edcfe2d98f6c8d5b7863f3120ce0 (patch) | |
tree | f55806cac1b794fc653d4a8d7998c308a055b0ea /sys/kern | |
parent | 770951112fdc457b869101242ab47ab1a7d6c8f9 (diff) | |
download | FreeBSD-src-9a81d01ee060edcfe2d98f6c8d5b7863f3120ce0.zip FreeBSD-src-9a81d01ee060edcfe2d98f6c8d5b7863f3120ce0.tar.gz |
If VOP_ADVLOCK() call or earlier checks failed don't check for a race with
close, because even if we had a race there is nothing to unlock.
Discussed with: kib
MFC after: 1 month
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_descrip.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index f5106e1..d7a2c23 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -668,6 +668,10 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) } VFS_UNLOCK_GIANT(vfslocked); vfslocked = 0; + if (error != 0) { + fdrop(fp, td); + break; + } /* Check for race with close */ FILEDESC_SLOCK(fdp); if (fget_locked(fdp, fd) != fp) { |