libceph: enable ceph in a non-default network namespace
Grab a reference on a network namespace of the 'rbd map' (in case of rbd) or 'mount' (in case of ceph) process and use that to open sockets instead of always using init_net and bailing if network namespace is anything but init_net. Be careful to not share struct ceph_client instances between different namespaces and don't add any code in the !CONFIG_NET_NS case. This is based on a patch from Hong Zhiguo <zhiguohong@tencent.com>. Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <linux/radix-tree.h>
|
||||
#include <linux/uio.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <net/net_namespace.h>
|
||||
|
||||
#include <linux/ceph/types.h>
|
||||
#include <linux/ceph/buffer.h>
|
||||
@@ -56,6 +57,7 @@ struct ceph_messenger {
|
||||
struct ceph_entity_addr my_enc_addr;
|
||||
|
||||
atomic_t stopping;
|
||||
possible_net_t net;
|
||||
bool nocrc;
|
||||
bool tcp_nodelay;
|
||||
|
||||
@@ -267,6 +269,7 @@ extern void ceph_messenger_init(struct ceph_messenger *msgr,
|
||||
u64 required_features,
|
||||
bool nocrc,
|
||||
bool tcp_nodelay);
|
||||
extern void ceph_messenger_fini(struct ceph_messenger *msgr);
|
||||
|
||||
extern void ceph_con_init(struct ceph_connection *con, void *private,
|
||||
const struct ceph_connection_operations *ops,
|
||||
|
||||
Reference in New Issue
Block a user