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));
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to