From b9a3a171cc981341d15cfec685507aabefe0f7a9 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 15 Nov 2004 16:10:55 +0000 Subject: Make FILE_LOCK and FILEDESC_LOCK nest properly by postponing the the release of FILEDESC_LOCK a few more lines. --- sys/kern/kern_descrip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 5a2f8df..1d1a22a 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -433,19 +433,19 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) case F_GETFL: /* mtx_assert(&Giant, MA_NOTOWNED); */ FILE_LOCK(fp); - FILEDESC_UNLOCK(fdp); td->td_retval[0] = OFLAGS(fp->f_flag); FILE_UNLOCK(fp); + FILEDESC_UNLOCK(fdp); break; case F_SETFL: mtx_assert(&Giant, MA_OWNED); FILE_LOCK(fp); - FILEDESC_UNLOCK(fdp); fhold_locked(fp); fp->f_flag &= ~FCNTLFLAGS; fp->f_flag |= FFLAGS(arg & ~O_ACCMODE) & FCNTLFLAGS; FILE_UNLOCK(fp); + FILEDESC_UNLOCK(fdp); tmp = fp->f_flag & FNONBLOCK; error = fo_ioctl(fp, FIONBIO, &tmp, td->td_ucred, td); if (error) { -- cgit v1.1