From 4c73e705a54b5e37745278de71bb9f313eb13398 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Fri, 21 Mar 2014 01:34:19 +0000 Subject: [PATCH] Take filedesc lock only for reading when allocating new fdtable. Code populating the table does this already. MFC after: 1 week --- sys/kern/kern_descrip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 2bf738228bd5..0a9e2f9001b0 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1808,7 +1808,7 @@ fdinit(struct filedesc *fdp) newfdp = malloc(sizeof *newfdp, M_FILEDESC, M_WAITOK | M_ZERO); FILEDESC_LOCK_INIT(&newfdp->fd_fd); if (fdp != NULL) { - FILEDESC_XLOCK(fdp); + FILEDESC_SLOCK(fdp); newfdp->fd_fd.fd_cdir = fdp->fd_cdir; if (newfdp->fd_fd.fd_cdir) VREF(newfdp->fd_fd.fd_cdir); @@ -1818,7 +1818,7 @@ fdinit(struct filedesc *fdp) newfdp->fd_fd.fd_jdir = fdp->fd_jdir; if (newfdp->fd_fd.fd_jdir) VREF(newfdp->fd_fd.fd_jdir); - FILEDESC_XUNLOCK(fdp); + FILEDESC_SUNLOCK(fdp); } /* Create the file descriptor table. */