summaryrefslogtreecommitdiffstats
path: root/sys/fs/msdosfs/msdosfs_fat.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2010-02-28 17:07:49 +0000
committerkib <kib@FreeBSD.org>2010-02-28 17:07:49 +0000
commitcc5d11fa86957084473b9eebf17dcdd1f3e7633d (patch)
tree06bd07b1e62206dff04fca9b303ec5de2ac5f1ae /sys/fs/msdosfs/msdosfs_fat.c
parent9be56bb3cbf4a01715415777c05d15ed42ba4c63 (diff)
downloadFreeBSD-src-cc5d11fa86957084473b9eebf17dcdd1f3e7633d.zip
FreeBSD-src-cc5d11fa86957084473b9eebf17dcdd1f3e7633d.tar.gz
Assert that the msdosfs vnode is (e)locked in several places.
The plan is to use vnode lock to protect denode and fat cache, and having separate lock for block use map. Change the check and return on impossible condition into KASSERT(). Tested by: pho MFC after: 3 weeks
Diffstat (limited to 'sys/fs/msdosfs/msdosfs_fat.c')
-rw-r--r--sys/fs/msdosfs/msdosfs_fat.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c
index 9677a7a..bb71d63 100644
--- a/sys/fs/msdosfs/msdosfs_fat.c
+++ b/sys/fs/msdosfs/msdosfs_fat.c
@@ -139,12 +139,9 @@ pcbmap(dep, findcn, bnp, cnp, sp)
struct msdosfsmount *pmp = dep->de_pmp;
u_long bsize;
- /*
- * If they don't give us someplace to return a value then don't
- * bother doing anything.
- */
- if (bnp == NULL && cnp == NULL && sp == NULL)
- return (0);
+ KASSERT(bnp != NULL || cnp != NULL || sp != NULL,
+ ("pcbmap: extra call"));
+ ASSERT_VOP_ELOCKED(DETOV(dep), "pcbmap");
cn = dep->de_StartCluster;
/*
@@ -270,6 +267,8 @@ fc_lookup(dep, findcn, frcnp, fsrcnp)
u_long cn;
struct fatcache *closest = 0;
+ ASSERT_VOP_LOCKED(DETOV(dep), "fc_lookup");
+
for (i = 0; i < FC_SIZE; i++) {
cn = dep->de_fc[i].fc_frcn;
if (cn != FCE_EMPTY && cn <= findcn) {
@@ -295,6 +294,8 @@ fc_purge(dep, frcn)
int i;
struct fatcache *fcp;
+ ASSERT_VOP_ELOCKED(DETOV(dep), "fc_purge");
+
fcp = dep->de_fc;
for (i = 0; i < FC_SIZE; i++, fcp++) {
if (fcp->fc_frcn >= frcn)
OpenPOWER on IntegriCloud