summaryrefslogtreecommitdiffstats
path: root/sys/fs/devfs
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2005-05-01 00:56:34 +0000
committerjeff <jeff@FreeBSD.org>2005-05-01 00:56:34 +0000
commit6c4a330d2824fdb8be812fa0d579f005582e4940 (patch)
tree705a22326efe83b576e851bb6de5a4aa46aa9b4f /sys/fs/devfs
parent17d6060ac9afc38ef9d5b09f7c28b8842a439bbd (diff)
downloadFreeBSD-src-6c4a330d2824fdb8be812fa0d579f005582e4940.zip
FreeBSD-src-6c4a330d2824fdb8be812fa0d579f005582e4940.tar.gz
- In devfs_open() and devfs_close() grab Giant if the driver sets NEEDGIANT.
We still have to DROP_GIANT and PICKUP_GIANT when NEEDGIANT is not set because vfs is still sometime entered with Giant held.
Diffstat (limited to 'sys/fs/devfs')
-rw-r--r--sys/fs/devfs/devfs_vnops.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 586aa9b..1a6ab3b 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -368,8 +368,11 @@ devfs_close(ap)
DROP_GIANT();
error = dsw->d_close(dev, ap->a_fflag, S_IFCHR, td);
PICKUP_GIANT();
- } else
+ } else {
+ mtx_lock(&Giant);
error = dsw->d_close(dev, ap->a_fflag, S_IFCHR, td);
+ mtx_unlock(&Giant);
+ }
dev_relthread(dev);
return (error);
}
@@ -815,10 +818,14 @@ devfs_open(ap)
else
error = dsw->d_open(dev, ap->a_mode, S_IFCHR, td);
PICKUP_GIANT();
- } else if (dsw->d_fdopen != NULL)
- error = dsw->d_fdopen(dev, ap->a_mode, td, ap->a_fdidx);
- else
- error = dsw->d_open(dev, ap->a_mode, S_IFCHR, td);
+ } else {
+ mtx_lock(&Giant);
+ if (dsw->d_fdopen != NULL)
+ error = dsw->d_fdopen(dev, ap->a_mode, td, ap->a_fdidx);
+ else
+ error = dsw->d_open(dev, ap->a_mode, S_IFCHR, td);
+ mtx_unlock(&Giant);
+ }
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
OpenPOWER on IntegriCloud