pluknet
2009-Sep-07 09:37 UTC
svn commit: r196210 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/cxgb dev/sound/usb dev/usb dev/usb/controller dev/usb/input dev/usb/mis...
2009/8/14 Konstantin Belousov <kib@freebsd.org>:> Author: kib > Date: Fri Aug 14 11:22:09 2009 > New Revision: 196210 > URL: http://svn.freebsd.org/changeset/base/196210 > > Log: > ?MFC r196206: > ?Take the number of allocated freeblks into consideration for > ?softdep_slowdown(), to prevent kernel memory exhaustioni on > ?mass-truncation. > > ?Approved by: ?re (rwatson) >[...] Hi. Is it scheduled to be merged to stable/7 (and even to stable/6, which also has this issue)? Thanks.> Modified: stable/8/sys/ufs/ffs/ffs_softdep.c > =============================================================================> --- stable/8/sys/ufs/ffs/ffs_softdep.c ?Fri Aug 14 11:17:34 2009 ? ? ? ?(r196209) > +++ stable/8/sys/ufs/ffs/ffs_softdep.c ?Fri Aug 14 11:22:09 2009 ? ? ? ?(r196210) > @@ -663,6 +663,8 @@ static int req_clear_inodedeps; ? ? /* synce > ?static int req_clear_remove; ? /* syncer process flush some freeblks */ > ?#define FLUSH_REMOVE ? ? ? ? ? 2 > ?#define FLUSH_REMOVE_WAIT ? ? ?3 > +static long num_freeblkdep; ? ?/* number of freeblks workitems allocated */ > + > ?/* > ?* runtime statistics > ?*/ > @@ -2223,6 +2225,9 @@ softdep_setup_freeblocks(ip, length, fla > ? ? ? ?freeblks->fb_uid = ip->i_uid; > ? ? ? ?freeblks->fb_previousinum = ip->i_number; > ? ? ? ?freeblks->fb_devvp = ip->i_devvp; > + ? ? ? ACQUIRE_LOCK(&lk); > + ? ? ? num_freeblkdep++; > + ? ? ? FREE_LOCK(&lk); > ? ? ? ?extblocks = 0; > ? ? ? ?if (fs->fs_magic == FS_UFS2_MAGIC) > ? ? ? ? ? ? ? ?extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize)); > @@ -2815,6 +2820,7 @@ handle_workitem_freeblocks(freeblks, fla > > ? ? ? ?ACQUIRE_LOCK(&lk); > ? ? ? ?WORKITEM_FREE(freeblks, D_FREEBLKS); > + ? ? ? num_freeblkdep--; > ? ? ? ?FREE_LOCK(&lk); > ?} > > @@ -5768,7 +5774,8 @@ softdep_slowdown(vp) > ? ? ? ?max_softdeps_hard = max_softdeps * 11 / 10; > ? ? ? ?if (num_dirrem < max_softdeps_hard / 2 && > ? ? ? ? ? ?num_inodedep < max_softdeps_hard && > - ? ? ? ? ? VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps) { > + ? ? ? ? ? VFSTOUFS(vp->v_mount)->um_numindirdeps < maxindirdeps && > + ? ? ? ? ? num_freeblkdep < max_softdeps_hard) { > ? ? ? ? ? ? ? ?FREE_LOCK(&lk); > ? ? ? ? ? ? ? ?return (0); > ? ? ? ?}-- wbr, pluknet