Retire clone_drain_lock
It is only ever xlocked in drain_dev_clone_events and the only consumer of that routine does not need it -- eventhandler code already makes sure the relevant callback is no longer running. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D36268
This commit is contained in:
parent
02d0c43c9e
commit
497240def8
@ -91,7 +91,6 @@ int devfs_pathpath(const char *, const char *);
|
||||
extern struct unrhdr *devfs_inos;
|
||||
extern struct mtx devmtx;
|
||||
extern struct mtx devfs_de_interlock;
|
||||
extern struct sx clone_drain_lock;
|
||||
extern struct mtx cdevpriv_mtx;
|
||||
extern TAILQ_HEAD(cdev_priv_list, cdev_priv) cdevp_list;
|
||||
|
||||
|
@ -85,8 +85,6 @@ static MALLOC_DEFINE(M_CDEVPDATA, "DEVFSP", "Metainfo for cdev-fp data");
|
||||
|
||||
struct mtx devfs_de_interlock;
|
||||
MTX_SYSINIT(devfs_de_interlock, &devfs_de_interlock, "devfs interlock", MTX_DEF);
|
||||
struct sx clone_drain_lock;
|
||||
SX_SYSINIT(clone_drain_lock, &clone_drain_lock, "clone events drain lock");
|
||||
struct mtx cdevpriv_mtx;
|
||||
MTX_SYSINIT(cdevpriv_mtx, &cdevpriv_mtx, "cdevpriv lock", MTX_DEF);
|
||||
|
||||
@ -1102,10 +1100,8 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlock)
|
||||
cdev = NULL;
|
||||
DEVFS_DMP_HOLD(dmp);
|
||||
sx_xunlock(&dmp->dm_lock);
|
||||
sx_slock(&clone_drain_lock);
|
||||
EVENTHANDLER_INVOKE(dev_clone,
|
||||
td->td_ucred, pname, strlen(pname), &cdev);
|
||||
sx_sunlock(&clone_drain_lock);
|
||||
|
||||
if (cdev == NULL)
|
||||
sx_xlock(&dmp->dm_lock);
|
||||
|
@ -1523,14 +1523,6 @@ destroy_dev_drain(struct cdevsw *csw)
|
||||
dev_unlock();
|
||||
}
|
||||
|
||||
void
|
||||
drain_dev_clone_events(void)
|
||||
{
|
||||
|
||||
sx_xlock(&clone_drain_lock);
|
||||
sx_xunlock(&clone_drain_lock);
|
||||
}
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#ifdef DDB
|
||||
#include <sys/kernel.h>
|
||||
|
@ -68,9 +68,7 @@ ctty_clone(void *arg, struct ucred *cred, char *name, int namelen,
|
||||
if (strcmp(name, "tty"))
|
||||
return;
|
||||
p = curproc;
|
||||
sx_sunlock(&clone_drain_lock);
|
||||
sx_slock(&proctree_lock);
|
||||
sx_slock(&clone_drain_lock);
|
||||
dev_lock();
|
||||
if (!(p->p_flag & P_CONTROLT))
|
||||
*dev = ctty;
|
||||
|
@ -707,7 +707,6 @@ tun_uninit(const void *unused __unused)
|
||||
|
||||
EVENTHANDLER_DEREGISTER(ifnet_arrival_event, arrival_tag);
|
||||
EVENTHANDLER_DEREGISTER(dev_clone, clone_tag);
|
||||
drain_dev_clone_events();
|
||||
|
||||
mtx_lock(&tunmtx);
|
||||
while ((tp = TAILQ_FIRST(&tunhead)) != NULL) {
|
||||
|
@ -279,7 +279,6 @@ void destroy_dev(struct cdev *_dev);
|
||||
int destroy_dev_sched(struct cdev *dev);
|
||||
int destroy_dev_sched_cb(struct cdev *dev, void (*cb)(void *), void *arg);
|
||||
void destroy_dev_drain(struct cdevsw *csw);
|
||||
void drain_dev_clone_events(void);
|
||||
struct cdevsw *dev_refthread(struct cdev *_dev, int *_ref);
|
||||
struct cdevsw *devvn_refthread(struct vnode *vp, struct cdev **devp, int *_ref);
|
||||
void dev_relthread(struct cdev *_dev, int _ref);
|
||||
|
Loading…
Reference in New Issue
Block a user