diff options
Diffstat (limited to 'net/sunrpc/svc_xprt.c')
-rw-r--r-- | net/sunrpc/svc_xprt.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 6ff5ca71602f..31853bfcd88d 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -70,6 +70,21 @@ void svc_unreg_xprt_class(struct svc_xprt_class *xcl) | |||
70 | } | 70 | } |
71 | EXPORT_SYMBOL_GPL(svc_unreg_xprt_class); | 71 | EXPORT_SYMBOL_GPL(svc_unreg_xprt_class); |
72 | 72 | ||
73 | static void svc_xprt_free(struct kref *kref) | ||
74 | { | ||
75 | struct svc_xprt *xprt = | ||
76 | container_of(kref, struct svc_xprt, xpt_ref); | ||
77 | struct module *owner = xprt->xpt_class->xcl_owner; | ||
78 | xprt->xpt_ops->xpo_free(xprt); | ||
79 | module_put(owner); | ||
80 | } | ||
81 | |||
82 | void svc_xprt_put(struct svc_xprt *xprt) | ||
83 | { | ||
84 | kref_put(&xprt->xpt_ref, svc_xprt_free); | ||
85 | } | ||
86 | EXPORT_SYMBOL_GPL(svc_xprt_put); | ||
87 | |||
73 | /* | 88 | /* |
74 | * Called by transport drivers to initialize the transport independent | 89 | * Called by transport drivers to initialize the transport independent |
75 | * portion of the transport instance. | 90 | * portion of the transport instance. |
@@ -79,6 +94,7 @@ void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt) | |||
79 | memset(xprt, 0, sizeof(*xprt)); | 94 | memset(xprt, 0, sizeof(*xprt)); |
80 | xprt->xpt_class = xcl; | 95 | xprt->xpt_class = xcl; |
81 | xprt->xpt_ops = xcl->xcl_ops; | 96 | xprt->xpt_ops = xcl->xcl_ops; |
97 | kref_init(&xprt->xpt_ref); | ||
82 | } | 98 | } |
83 | EXPORT_SYMBOL_GPL(svc_xprt_init); | 99 | EXPORT_SYMBOL_GPL(svc_xprt_init); |
84 | 100 | ||