diff options
author | hsu <hsu@FreeBSD.org> | 2003-01-21 20:20:48 +0000 |
---|---|---|
committer | hsu <hsu@FreeBSD.org> | 2003-01-21 20:20:48 +0000 |
commit | 95173465f516a70d32ad373849f753432ebd94dd (patch) | |
tree | 80124e4d20a5843cd261d12fb5d3c05009c25663 /sys/kern/kern_descrip.c | |
parent | aa1fbe41c163ca9ee6d55c6a83ea25fccb5d87e7 (diff) | |
download | FreeBSD-src-95173465f516a70d32ad373849f753432ebd94dd.zip FreeBSD-src-95173465f516a70d32ad373849f753432ebd94dd.tar.gz |
Add missing SMP file locks around read-modify-write operations on
the flag field.
Reviewed by: rwatson
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r-- | sys/kern/kern_descrip.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index a05eb25..0c39299 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -288,10 +288,12 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) break; case F_SETFL: - fhold(fp); + FILE_LOCK(fp); FILEDESC_UNLOCK(fdp); + fhold_locked(fp); fp->f_flag &= ~FCNTLFLAGS; fp->f_flag |= FFLAGS(arg & ~O_ACCMODE) & FCNTLFLAGS; + FILE_UNLOCK(fp); tmp = fp->f_flag & FNONBLOCK; error = fo_ioctl(fp, FIONBIO, &tmp, td->td_ucred, td); if (error) { @@ -304,7 +306,9 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg) fdrop(fp, td); break; } + FILE_LOCK(fp); fp->f_flag &= ~FNONBLOCK; + FILE_UNLOCK(fp); tmp = 0; (void)fo_ioctl(fp, FIONBIO, &tmp, td->td_ucred, td); fdrop(fp, td); |