svn commit: r308543 - stable/11/sys/fs/msdosfs

Konstantin Belousov kib at FreeBSD.org
Fri Nov 11 19:35:59 UTC 2016


Author: kib
Date: Fri Nov 11 19:35:58 2016
New Revision: 308543
URL: https://svnweb.freebsd.org/changeset/base/308543

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

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

Modified: stable/11/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- stable/11/sys/fs/msdosfs/msdosfs_fat.c	Fri Nov 11 19:33:26 2016	(r308542)
+++ stable/11/sys/fs/msdosfs/msdosfs_fat.c	Fri Nov 11 19:35:58 2016	(r308543)
@@ -691,8 +691,11 @@ chainalloc(struct msdosfsmount *pmp, u_l
 		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);


More information about the svn-src-stable-11 mailing list