[redhat-lspp] RE: [IPSEC] flow: Cache negative results

Venkat Yekkirala vyekkirala at trustedcs.com
Fri Jan 12 22:58:02 UTC 2007


> > Please let me know if this looks ok and I am not
> > jumping the gun. This only applies to our lspp kernel 
> > and was built against lspp62 kernel.

Actually, you would also want propagate non-ESRCH errors back
up the chain as shown in the below:

@@ -609,7 +609,7 @@ static int xfrm_policy_lookup(struct flo
                               void **objp, atomic_t **obj_refp)
 {
        struct xfrm_policy *pol;
-       int ret = -ESRCH;
+       int ret = 0;
 
        read_lock_bh(&xfrm_policy_lock);
        for (pol = xfrm_policy_list[dir]; pol; pol = pol->next) {
@@ -626,12 +626,16 @@ static int xfrm_policy_lookup(struct flo
                        if (!ret) {
                                xfrm_pol_hold(pol);
                                break;
-                       }
+                       } else if (ret == -ESRCH)
+                               ret = 0;
+                       else
+                               goto fail;
                }
        }
        read_unlock_bh(&xfrm_policy_lock);
        if ((*objp = (void *) pol) != NULL)
                *obj_refp = &pol->refcnt;
+fail:
        return ret;
 }




More information about the redhat-lspp mailing list