git: 71bd18d37359 - main - fd: use seqc_read_notmodify when translating fds

Mateusz Guzik mjg at FreeBSD.org
Thu Jan 7 23:30:22 UTC 2021


The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=71bd18d37359bbd7d5923898d40fd9993d5c15f7

commit 71bd18d37359bbd7d5923898d40fd9993d5c15f7
Author:     Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-01-07 06:34:14 +0000
Commit:     Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2021-01-07 23:30:04 +0000

    fd: use seqc_read_notmodify when translating fds
---
 sys/kern/kern_descrip.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index e1ffdc3baf01..ad1916e87b68 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -2921,9 +2921,7 @@ fgetvp_lookup_smr(int fd, struct nameidata *ndp, struct vnode **vpp, bool *fsear
 	fdt = fdp->fd_files;
 	if (__predict_false((u_int)fd >= fdt->fdt_nfiles))
 		return (EBADF);
-	seq = seqc_read_any(fd_seqc(fdt, fd));
-	if (__predict_false(seqc_in_modify(seq)))
-		return (EAGAIN);
+	seq = seqc_read_notmodify(fd_seqc(fdt, fd));
 	fde = &fdt->fdt_ofiles[fd];
 	haverights = cap_rights_fde_inline(fde);
 	fp = fde->fde_file;
@@ -3032,7 +3030,7 @@ fget_unlocked_seq(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
 	 */
 	for (;;) {
 #ifdef CAPABILITIES
-		seq = seqc_read(fd_seqc(fdt, fd));
+		seq = seqc_read_notmodify(fd_seqc(fdt, fd));
 		fde = &fdt->fdt_ofiles[fd];
 		haverights = *cap_rights_fde_inline(fde);
 		fp = fde->fde_file;
@@ -3105,9 +3103,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp,
 	if (__predict_false((u_int)fd >= fdt->fdt_nfiles))
 		return (EBADF);
 #ifdef CAPABILITIES
-	seq = seqc_read_any(fd_seqc(fdt, fd));
-	if (__predict_false(seqc_in_modify(seq)))
-		goto out_fallback;
+	seq = seqc_read_notmodify(fd_seqc(fdt, fd));
 	fde = &fdt->fdt_ofiles[fd];
 	haverights = cap_rights_fde_inline(fde);
 	fp = fde->fde_file;


More information about the dev-commits-src-all mailing list