Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 Oct 2015 12:36:28 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288989 - head/sys/ufs/ffs
Message-ID:  <201510071236.t97CaS0U013796@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Wed Oct  7 12:36:28 2015
New Revision: 288989
URL: https://svnweb.freebsd.org/changeset/base/288989

Log:
  In softdep_setup_freeblocks():
  - Move the bread() to the beginning of function.
  - Return if it fails, otherwise we will panic.
  
  Submitted by:	mckusick
  Sponsored by:	Netflix

Modified:
  head/sys/ufs/ffs/ffs_softdep.c

Modified: head/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- head/sys/ufs/ffs/ffs_softdep.c	Wed Oct  7 09:41:17 2015	(r288988)
+++ head/sys/ufs/ffs/ffs_softdep.c	Wed Oct  7 12:36:28 2015	(r288989)
@@ -6835,6 +6835,13 @@ softdep_setup_freeblocks(ip, length, fla
 	    ip->i_number, length);
 	KASSERT(length == 0, ("softdep_setup_freeblocks: non-zero length"));
 	fs = ip->i_fs;
+	if ((error = bread(ip->i_devvp,
+	    fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
+	    (int)fs->fs_bsize, NOCRED, &bp)) != 0) {
+		brelse(bp);
+		softdep_error("softdep_setup_freeblocks", error);
+		return;
+	}
 	freeblks = newfreeblks(mp, ip);
 	extblocks = 0;
 	datablocks = 0;
@@ -6871,12 +6878,6 @@ softdep_setup_freeblocks(ip, length, fla
 	 * to delete its dependencies below. Once the dependencies are gone
 	 * the buffer can be safely released.
 	 */
-	if ((error = bread(ip->i_devvp,
-	    fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
-	    (int)fs->fs_bsize, NOCRED, &bp)) != 0) {
-		brelse(bp);
-		softdep_error("softdep_setup_freeblocks", error);
-	}
 	if (ump->um_fstype == UFS1) {
 		dp1 = ((struct ufs1_dinode *)bp->b_data +
 		    ino_to_fsbo(fs, ip->i_number));



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