History

NFS: hard-code init_net for NFS callback transports

In case of destroying mount namespace on child reaper exit, nsproxy is zeroed to the point already. So, dereferencing of it is invalid. This patch hard-code "init_net" for all network namespace references for NFS callback services. This will be fixed with proper NFS callback containerization.

Stanislav Kinsbursky committed 14 years ago

Commit 12918b11 parent cfaf0251 file · +5 −6Browse files

Unified · Split

fs/nfs/callback.c+5−6
@@ -17,7 +17,6 @@ · 16 unmodified lines
1717 #include <linux/kthread.h>
1818 #include <linux/sunrpc/svcauth_gss.h>
1919 #include <linux/sunrpc/bc_xprt.h>
20−#include <linux/nsproxy.h>
2120
2221 #include <net/inet_sock.h>
2322
@@ -107,7 +106,7 @@ nfs4_callback_up(struct svc_serv *serv, struct rpc_xprt *xprt) · 83 unmodified lines
107106 {
108107 int ret;
109108
110− ret = svc_create_xprt(serv, "tcp", xprt->xprt_net, PF_INET,
109+ ret = svc_create_xprt(serv, "tcp", &init_net, PF_INET,
111110 nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
112111 if (ret <= 0)
113112 goto out_err;
@@ -115,7 +114,7 @@ nfs4_callback_up(struct svc_serv *serv, struct rpc_xprt *xprt) · 1 unmodified line
115114 dprintk("NFS: Callback listener port = %u (af %u)\n",
116115 nfs_callback_tcpport, PF_INET);
117116
118− ret = svc_create_xprt(serv, "tcp", xprt->xprt_net, PF_INET6,
117+ ret = svc_create_xprt(serv, "tcp", &init_net, PF_INET6,
119118 nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
120119 if (ret > 0) {
121120 nfs_callback_tcpport6 = ret;
@@ -184,7 +183,7 @@ nfs41_callback_up(struct svc_serv *serv, struct rpc_xprt *xprt) · 62 unmodified lines
184183 * fore channel connection.
185184 * Returns the input port (0) and sets the svc_serv bc_xprt on success
186185 */
187− ret = svc_create_xprt(serv, "tcp-bc", xprt->xprt_net, PF_INET, 0,
186+ ret = svc_create_xprt(serv, "tcp-bc", &init_net, PF_INET, 0,
188187 SVC_SOCK_ANONYMOUS);
189188 if (ret < 0) {
190189 rqstp = ERR_PTR(ret);
@@ -254,7 +253,7 @@ int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt) · 63 unmodified lines
254253 char svc_name[12];
255254 int ret = 0;
256255 int minorversion_setup;
257− struct net *net = current->nsproxy->net_ns;
256+ struct net *net = &init_net;
258257
259258 mutex_lock(&nfs_callback_mutex);
260259 if (cb_info->users++ || cb_info->task != NULL) {
@@ -330,7 +329,7 @@ void nfs_callback_down(int minorversion) · 69 unmodified lines
330329 cb_info->users--;
331330 if (cb_info->users == 0 && cb_info->task != NULL) {
332331 kthread_stop(cb_info->task);
333− svc_shutdown_net(cb_info->serv, current->nsproxy->net_ns);
332+ svc_shutdown_net(cb_info->serv, &init_net);
334333 svc_exit_thread(cb_info->rqst);
335334 cb_info->serv = NULL;
336335 cb_info->rqst = NULL;