Add some KASSERTs. Reacquire a mutex after a kernel printf rather

than holding it during the printf. White space cleanup.

Sponsored by: Netflix
This commit is contained in:
Kirk McKusick 2019-11-20 01:10:01 +00:00
parent 51b867e56b
commit 486b9a61f7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=354872

View File

@ -9881,6 +9881,9 @@ handle_workitem_remove(dirrem, flags)
*/
if ((dirrem->dm_state & RMDIR) == 0) {
ip->i_nlink--;
KASSERT(ip->i_nlink >= 0, ("handle_workitem_remove: file ino "
"%ju negative i_nlink %d", (intmax_t)ip->i_number,
ip->i_nlink));
DIP_SET(ip, i_nlink, ip->i_nlink);
ip->i_flag |= IN_CHANGE;
if (ip->i_nlink < ip->i_effnlink)
@ -9902,6 +9905,8 @@ handle_workitem_remove(dirrem, flags)
* to account for the loss of "..".
*/
ip->i_nlink -= 2;
KASSERT(ip->i_nlink >= 0, ("handle_workitem_remove: directory ino "
"%ju negative i_nlink %d", (intmax_t)ip->i_number, ip->i_nlink));
DIP_SET(ip, i_nlink, ip->i_nlink);
ip->i_flag |= IN_CHANGE;
if (ip->i_nlink < ip->i_effnlink)
@ -10802,7 +10807,6 @@ softdep_setup_inofree(mp, bp, ino, wkhd)
FREE_LOCK(ump);
}
/*
* Called via ffs_blkfree() after a set of frags has been cleared from a cg
* map. Any dependencies waiting for the write to clear are added to the
@ -12265,6 +12269,8 @@ softdep_load_inodeblock(ip)
return;
}
ip->i_effnlink -= inodedep->id_nlinkdelta;
KASSERT(ip->i_effnlink >= 0,
("softdep_load_inodeblock: negative i_effnlink"));
FREE_LOCK(ump);
}
@ -13429,9 +13435,9 @@ softdep_request_cleanup(fs, vp, cred, resource)
roundup((fs->fs_dsize * fs->fs_minfree / 100) -
fs->fs_cstotal.cs_nffree, fs->fs_frag));
} else {
UFS_LOCK(ump);
printf("softdep_request_cleanup: Unknown resource type %d\n",
resource);
UFS_LOCK(ump);
return (0);
}
starttime = time_second;