Assert that an msdosfs mount is not read-only when FAT modifications
are requested. PR: 199152 Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
e1f0bb305b
commit
420d65d9e4
@ -380,6 +380,8 @@ usemap_alloc(struct msdosfsmount *pmp, u_long 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]));
|
||||
@ -394,6 +396,8 @@ usemap_free(struct msdosfsmount *pmp, u_long 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)))
|
||||
@ -675,6 +679,8 @@ chainalloc(struct msdosfsmount *pmp, u_long start, u_long count,
|
||||
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++);
|
||||
|
Loading…
Reference in New Issue
Block a user