Author: kib
Date: Sun Apr 12 07:03:26 2015
New Revision: 281456
URL: https://svnweb.freebsd.org/changeset/base/281456

Log:
  MFC r281120:
  Assert that an msdosfs mount is not read-only when FAT modifications
  are requested.

Modified:
  stable/10/sys/fs/msdosfs/msdosfs_fat.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- stable/10/sys/fs/msdosfs/msdosfs_fat.c      Sun Apr 12 06:54:53 2015        
(r281455)
+++ stable/10/sys/fs/msdosfs/msdosfs_fat.c      Sun Apr 12 07:03:26 2015        
(r281456)
@@ -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, 
        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++);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to