Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Oct 2016 11:26:44 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r308023 - head/sys/fs/msdosfs
Message-ID:  <201610281126.u9SBQiOS000639@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Oct 28 11:26:44 2016
New Revision: 308023
URL: https://svnweb.freebsd.org/changeset/base/308023

Log:
  If the fatchain() call in chainalloc() returned an error, revert
  marking the cluster run as in-use.
  
  Tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	2 weeks

Modified:
  head/sys/fs/msdosfs/msdosfs_fat.c

Modified: head/sys/fs/msdosfs/msdosfs_fat.c
==============================================================================
--- head/sys/fs/msdosfs/msdosfs_fat.c	Fri Oct 28 11:23:36 2016	(r308022)
+++ head/sys/fs/msdosfs/msdosfs_fat.c	Fri Oct 28 11:26:44 2016	(r308023)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610281126.u9SBQiOS000639>