Patch from Krzysztof Blaszkowski:
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Wed, 18 Feb 2009 19:17:29 +0000 (19:17 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Wed, 18 Feb 2009 19:17:29 +0000 (19:17 +0000)
i noticed this issue running simple iscsi connection test to a few targets.
without included patch the active_pages_total counter wraps around 0 thus it
breaks logic for releasing memory on "hi watermark" just like it is depicted
in:

Inactive/active pages                      18/-25
Hi/lo watermarks [pages]                   119808/0
Hi watermark releases/failures             4/0

git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@676 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/src/scst_mem.c

index 5dd09ad..445edc4 100644 (file)
@@ -895,8 +895,8 @@ struct scatterlist *scst_alloc(int size, gfp_t gfp_mask, int *count)
 
        atomic_inc(&sgv_pools_mgr.sgv_other_total_alloc);
 
-       if (unlikely(!no_fail)) {
-               if (unlikely(sgv_pool_hiwmk_check(pages) != 0)) {
+       if (unlikely(sgv_pool_hiwmk_check(pages) != 0)) {
+               if (!no_fail) {
                        res = NULL;
                        goto out;
                }
@@ -922,7 +922,7 @@ struct scatterlist *scst_alloc(int size, gfp_t gfp_mask, int *count)
                goto out_free;
 
 out:
-       TRACE_MEM("Alloced sg %p (count %d)", res, *count);
+       TRACE_MEM("Alloced sg %p (count %d) \"no fail\" %d", res, *count, no_fail);
 
        TRACE_EXIT_HRES(res);
        return res;