git: 8f268240ee60 - main - Revert "fcntl(F_SETFL): only allow one thread to perform F_SETFL"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 Sep 2025 19:23:02 UTC
The branch main has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=8f268240ee60b55f29910c89f546dbecf412c94c
commit 8f268240ee60b55f29910c89f546dbecf412c94c
Author: Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2025-09-19 19:14:19 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-09-19 19:22:44 +0000
Revert "fcntl(F_SETFL): only allow one thread to perform F_SETFL"
Temporarily back this out to fix the tree while I try 16.0 snapshot
builds. It will come back once D52626 lands.
This reverts commit 40a42785dbba93cc5196178fc49d340c1a89cabe.
Discussed with: kib
---
sys/kern/kern_descrip.c | 3 ---
sys/kern/vfs_vnops.c | 36 ------------------------------------
sys/sys/file.h | 4 ----
3 files changed, 43 deletions(-)
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 19118eb7f275..2a833d2eafbe 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -658,7 +658,6 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg)
error = EBADF;
break;
}
- fsetfl_lock(fp);
do {
tmp = flg = fp->f_flag;
tmp &= ~FCNTLFLAGS;
@@ -678,7 +677,6 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg)
if (error != 0)
goto revert_nonblock;
}
- fsetfl_unlock(fp);
fdrop(fp, td);
break;
revert_nonblock:
@@ -693,7 +691,6 @@ revert_flags:
tmp |= got_cleared;
tmp &= ~got_set;
} while (atomic_cmpset_int(&fp->f_flag, flg, tmp) == 0);
- fsetfl_unlock(fp);
fdrop(fp, td);
break;
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 3d4567b6ab1e..f81c2033d95e 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -896,18 +896,6 @@ foffset_read(struct file *fp)
return (atomic_load_long(&fp->f_offset));
}
-void
-fsetfl_lock(struct file *fp)
-{
- file_v_lock(fp, FILE_V_SETFL_LOCKED, FILE_V_SETFL_LOCK_WAITING);
-}
-
-void
-fsetfl_unlock(struct file *fp)
-{
- file_v_unlock(fp, FILE_V_SETFL_LOCKED, FILE_V_SETFL_LOCK_WAITING);
-}
-
#else /* OFF_MAX <= LONG_MAX */
static void
@@ -983,30 +971,6 @@ foffset_read(struct file *fp)
return (foffset_lock(fp, FOF_NOLOCK));
}
-
-void
-fsetfl_lock(struct file *fp)
-{
- struct mtx *mtxp;
-
- mtxp = mtx_pool_find(mtxpool_sleep, fp);
- mtx_lock(mtxp);
- file_v_lock_mtxp(fp, mtxp, FILE_V_SETFL_LOCKED,
- FILE_V_SETFL_LOCK_WAITING);
- mtx_unlock(mtxp);
-}
-
-void
-fsetfl_unlock(struct file *fp)
-{
- struct mtx *mtxp;
-
- mtxp = mtx_pool_find(mtxpool_sleep, fp);
- mtx_lock(mtxp);
- file_v_unlock_mtxp(fp, mtxp, FILE_V_SETFL_LOCKED,
- FILE_V_SETFL_LOCK_WAITING);
- mtx_unlock(mtxp);
-}
#endif
void
diff --git a/sys/sys/file.h b/sys/sys/file.h
index c44fd0f28929..9a072121e25f 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -93,8 +93,6 @@ void foffset_lock_pair(struct file *fp1, off_t *off1p, struct file *fp2,
void foffset_lock_uio(struct file *fp, struct uio *uio, int flags);
void foffset_unlock(struct file *fp, off_t val, int flags);
void foffset_unlock_uio(struct file *fp, struct uio *uio, int flags);
-void fsetfl_lock(struct file *fp);
-void fsetfl_unlock(struct file *fp);
static inline off_t
foffset_get(struct file *fp)
@@ -224,8 +222,6 @@ struct file {
#define FILE_V_FOFFSET_LOCKED 0x0001
#define FILE_V_FOFFSET_LOCK_WAITING 0x0002
-#define FILE_V_SETFL_LOCKED 0x0004
-#define FILE_V_SETFL_LOCK_WAITING 0x0008
#endif /* __BSD_VISIBLE */
#endif /* _KERNEL || _WANT_FILE */