* [PATCH] svcsock: Add a reference to sunrpc in svc_addsock
@ 2008-11-23 14:08 Tom Tucker
2008-11-24 15:25 ` Jeff Moyer
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tucker @ 2008-11-23 14:08 UTC (permalink / raw)
To: tom, bfields; +Cc: jlayton, jmoyer, linux-nfs, Tom Tucker
The svc_addsock function adds transport instances without taking a
reference on the sunrpc.ko module, however, the generic transport
destruction code drops a reference when a transport instance
is destroyed.
Add a try_module_get call to the svc_addsock function for transport
instances added by this function.
Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
---
net/sunrpc/svcsock.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 95293f5..a1951dc 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -1183,7 +1183,11 @@ int svc_addsock(struct svc_serv *serv,
else if (so->state > SS_UNCONNECTED)
err = -EISCONN;
else {
- svsk = svc_setup_socket(serv, so, &err, SVC_SOCK_DEFAULTS);
+ if (!try_module_get(THIS_MODULE))
+ err = -ENOENT;
+ else
+ svsk = svc_setup_socket(serv, so, &err,
+ SVC_SOCK_DEFAULTS);
if (svsk) {
struct sockaddr_storage addr;
struct sockaddr *sin = (struct sockaddr *)&addr;
@@ -1196,7 +1200,8 @@ int svc_addsock(struct svc_serv *serv,
spin_unlock_bh(&serv->sv_lock);
svc_xprt_received(&svsk->sk_xprt);
err = 0;
- }
+ } else
+ module_put(THIS_MODULE);
}
if (err) {
sockfd_put(so);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] svcsock: Add a reference to sunrpc in svc_addsock
2008-11-23 14:08 [PATCH] svcsock: Add a reference to sunrpc in svc_addsock Tom Tucker
@ 2008-11-24 15:25 ` Jeff Moyer
[not found] ` <x491vx1f8o9.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Moyer @ 2008-11-24 15:25 UTC (permalink / raw)
To: Tom Tucker; +Cc: bfields, jlayton, linux-nfs
Tom Tucker <tom@opengridcomputing.com> writes:
> The svc_addsock function adds transport instances without taking a
> reference on the sunrpc.ko module, however, the generic transport
> destruction code drops a reference when a transport instance
> is destroyed.
>
> Add a try_module_get call to the svc_addsock function for transport
> instances added by this function.
>
> Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Tested-by: Jeff Moyer <jmoyer@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] svcsock: Add a reference to sunrpc in svc_addsock
[not found] ` <x491vx1f8o9.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
@ 2008-11-24 19:27 ` J. Bruce Fields
0 siblings, 0 replies; 3+ messages in thread
From: J. Bruce Fields @ 2008-11-24 19:27 UTC (permalink / raw)
To: Jeff Moyer; +Cc: Tom Tucker, jlayton, linux-nfs
On Mon, Nov 24, 2008 at 10:25:10AM -0500, Jeff Moyer wrote:
> Tom Tucker <tom@opengridcomputing.com> writes:
>
> > The svc_addsock function adds transport instances without taking a
> > reference on the sunrpc.ko module, however, the generic transport
> > destruction code drops a reference when a transport instance
> > is destroyed.
> >
> > Add a try_module_get call to the svc_addsock function for transport
> > instances added by this function.
> >
> > Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
> Tested-by: Jeff Moyer <jmoyer@redhat.com>
Done, thanks.--b.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-24 19:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-23 14:08 [PATCH] svcsock: Add a reference to sunrpc in svc_addsock Tom Tucker
2008-11-24 15:25 ` Jeff Moyer
[not found] ` <x491vx1f8o9.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
2008-11-24 19:27 ` J. Bruce Fields
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.