diff options
author | Neil Brown <neilb@cse.unsw.edu.au> | 2004-08-22 23:00:47 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-08-22 23:00:47 -0700 |
commit | 0be5edbc2e0626ec327a29ee9555fd93f6332dc4 (patch) | |
tree | 3f7c9daee7e7a3078ec8b233880aeaec429f3a0f /net | |
parent | 4feb71cc86bfabfd357787191bc3f77ab33dd088 (diff) | |
download | history-0be5edbc2e0626ec327a29ee9555fd93f6332dc4.tar.gz |
[PATCH] nfsd: make cache_init initialize reference count to 1
Presumably anyone creating a new cache entry is going to want a reference on
that cache; and indeed every caller of cache_init increments the reference
count immediately afterwards. So may as well make cache_init set an initial
reference count of 1.
Also, note that cache_init initializes the flags; callers don't need to.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 2 | ||||
-rw-r--r-- | net/sunrpc/cache.c | 2 | ||||
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 2 |
3 files changed, 1 insertions, 5 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 5822ab211707f6..ee2e9cef94c267 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -643,7 +643,6 @@ svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name) if (!new) goto out; cache_init(&new->h.h); - atomic_inc(&new->h.h.refcnt); new->h.name = kmalloc(strlen(name) + 1, GFP_KERNEL); if (!new->h.name) goto out_free_dom; @@ -651,7 +650,6 @@ svcauth_gss_register_pseudoflavor(u32 pseudoflavor, char * name) new->h.flavour = RPC_AUTH_GSS; new->pseudoflavor = pseudoflavor; new->h.h.expiry_time = NEVER; - new->h.h.flags = 0; test = auth_domain_lookup(&new->h, 1); if (test == &new->h) { diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index bb54be85152326..1ceeb11591bfbe 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c @@ -38,7 +38,7 @@ void cache_init(struct cache_head *h) time_t now = get_seconds(); h->next = NULL; h->flags = 0; - atomic_set(&h->refcnt, 0); + atomic_set(&h->refcnt, 1); h->expiry_time = now + CACHE_NEW_EXPIRY; h->last_refresh = now; } diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 14e51e119716fd..949a33f753d91a 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c @@ -55,12 +55,10 @@ struct auth_domain *unix_domain_find(char *name) if (new == NULL) return NULL; cache_init(&new->h.h); - atomic_inc(&new->h.h.refcnt); new->h.name = strdup(name); new->h.flavour = RPC_AUTH_UNIX; new->addr_changes = 0; new->h.h.expiry_time = NEVER; - new->h.h.flags = 0; rv = auth_domain_lookup(&new->h, 2); if (rv == &new->h) { |