OpenVZ Forum - RDF feed
type: channel
items: [PATCH] Make CIFS mount work in a container.

[PATCH] Make CIFS mount work in a container.
type: item
description: From: Rob Landley <rlandley@parallels.com> Teach cifs about network namespaces, so mounting uses adresses/routing visible from the container rather than from init context. For a long drawn out test reproduction sequence, see: http://landley.livejournal.com/47024.html http://landley.livejournal.com/47205.html http://landley.livejournal.com/47476.html Signed-off-by: Rob Landley <rlandley@parallels.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> --- Several other people commented on the patch without giving a formal byline, see: https://lists.linux-foundation.org/pipermail/containers/2011 -January/026250.html This is version three of the patch. Discussion on the other lists seems to have died down, and it Works For Me (tm). The patch is almost size neutral when CONFIG_NET_NS is disabled, everything but the switch from sock_create_kern() to __sock_create() (which has two more function arguments) drops out. fs/cifs/cifsglob.h | 33 +++++++++++++++++++++++++++++++++ fs/cifs/connect.c | 12 ++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 606ca8b..54cd4ab 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -165,6 +165,9 @@ struct TCP_Server_Info { struct socket *ssocket; struct sockaddr_storage dstaddr; struct sockaddr_storage srcaddr; /* locally bind to this IP */ +#ifdef CONFIG_NET_NS + struct net *net; +#endif wait_queue_head_t response_q; wait_queue_head_t request_q; /* if more than maxmpx to srvr must block*/ struct list_head pending_mid_q; @@ -224,6 +227,36 @@ struct TCP_Server_Info { }; /* + * Macros to allow the TCP_Server_Info->net field and related code to drop out + * when CONFIG_NET_NS isn't set. + */ + +#ifdef CONFIG_NET_NS + +static inline struct net *cifs_net_ns(struct TCP_Server_Info *srv) +{ + return srv->net; +} + +static inline void cifs_set_net_ns(struct TCP_Server_Info *srv, struct net *net) +{ + srv->net = net; +} + +#else + +static inline struct net *cifs_net_ns(struct …
creator: Rob Landley
date: 2011-01-22T21:44:05-00:00