Author: kib
Date: Fri Nov 11 20:04:19 2016
New Revision: 308550
URL: https://svnweb.freebsd.org/changeset/base/308550

Log:
  MFC r308023:
  If the fatchain() call in chainalloc() returned an error, revert
  marking the cluster run as in-use.

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      Fri Nov 11 20:01:56 2016        
(r308549)
+++ stable/10/sys/fs/msdosfs/msdosfs_fat.c      Fri Nov 11 20:04:19 2016        
(r308550)
@@ -731,8 +731,11 @@ chainalloc(pmp, start, count, fillwith, 
                pmp->pm_nxtfree = CLUST_FIRST;
        pmp->pm_flags |= MSDOSFS_FSIMOD;
        error = fatchain(pmp, start, count, fillwith);
-       if (error != 0)
+       if (error != 0) {
+               for (cl = start, n = count; n-- > 0;)
+                       usemap_free(pmp, cl++);
                return (error);
+       }
 #ifdef MSDOSFS_DEBUG
        printf("clusteralloc(): allocated cluster chain at %lu (%lu 
clusters)\n",
            start, count);
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to