From cf6596d5abb0225665ac229fc10a559b13450d6c Mon Sep 17 00:00:00 2001 From: kib Date: Sun, 12 Apr 2015 07:03:26 +0000 Subject: MFC r281120: Assert that an msdosfs mount is not read-only when FAT modifications are requested. --- sys/fs/msdosfs/msdosfs_fat.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys/fs') diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c index c660601..3c46c03 100644 --- a/sys/fs/msdosfs/msdosfs_fat.c +++ b/sys/fs/msdosfs/msdosfs_fat.c @@ -399,6 +399,8 @@ usemap_alloc(pmp, cn) MSDOSFS_ASSERT_MP_LOCKED(pmp); + KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, + ("usemap_alloc on ro msdosfs mount")); KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) == 0, ("Allocating used sector %ld %ld %x", cn, cn % N_INUSEBITS, (unsigned)pmp->pm_inusemap[cn / N_INUSEBITS])); @@ -415,6 +417,8 @@ usemap_free(pmp, cn) { MSDOSFS_ASSERT_MP_LOCKED(pmp); + KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, + ("usemap_free on ro msdosfs mount")); pmp->pm_freeclustercount++; pmp->pm_flags |= MSDOSFS_FSIMOD; KASSERT((pmp->pm_inusemap[cn / N_INUSEBITS] & (1 << (cn % N_INUSEBITS))) @@ -715,6 +719,8 @@ chainalloc(pmp, start, count, fillwith, retcluster, got) u_long cl, n; MSDOSFS_ASSERT_MP_LOCKED(pmp); + KASSERT((pmp->pm_flags & MSDOSFSMNT_RONLY) == 0, + ("chainalloc on ro msdosfs mount")); for (cl = start, n = count; n-- > 0;) usemap_alloc(pmp, cl++); -- cgit v1.1