提交 4c0a9f74 编写于 作者: L Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client

Pull Ceph fixes from Sage Weil:
 "There is a fix for CephFS and RBD when used within containers/namespaces,
   and a fix for the address learning the client is supposed to do when
  initially talking to the Ceph cluster.

  There are also two patches updating MAINTAINERS.  One breaks out the
  common Ceph code shared by fs/ceph and drivers/block/rbd.c into a
  separate entry with the appropriate maintainers listed.  The second
  adds a second reference to the github tree where the Ceph client
  development takes place (before it is pushed to korg and then to you).

  The goal here is to move closer to a situation where Ilya Dryomov or
  one of the other maintainers can push things to you if I am
  unavailable.  Ilya has done most of the work preparing branches for
  upstream recently; you should not be surprised to hear from him if I
  am trapped in some internet-less wasteland or hit by a bus or
  something.  In the meantime, we'll work on getting him added to the
  kernel web of trust"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
  MAINTAINERS: add secondary tree for ceph modules
  MAINTAINERS: update ceph entries
  libceph: treat sockaddr_storage with uninitialized family as blank
  libceph: enable ceph in a non-default network namespace
...@@ -2562,19 +2562,31 @@ F: arch/powerpc/include/uapi/asm/spu*.h ...@@ -2562,19 +2562,31 @@ F: arch/powerpc/include/uapi/asm/spu*.h
F: arch/powerpc/oprofile/*cell* F: arch/powerpc/oprofile/*cell*
F: arch/powerpc/platforms/cell/ F: arch/powerpc/platforms/cell/
CEPH DISTRIBUTED FILE SYSTEM CLIENT CEPH COMMON CODE (LIBCEPH)
M: Ilya Dryomov <idryomov@gmail.com>
M: "Yan, Zheng" <zyan@redhat.com> M: "Yan, Zheng" <zyan@redhat.com>
M: Sage Weil <sage@redhat.com> M: Sage Weil <sage@redhat.com>
L: ceph-devel@vger.kernel.org L: ceph-devel@vger.kernel.org
W: http://ceph.com/ W: http://ceph.com/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
T: git git://github.com/ceph/ceph-client.git
S: Supported S: Supported
F: Documentation/filesystems/ceph.txt
F: fs/ceph/
F: net/ceph/ F: net/ceph/
F: include/linux/ceph/ F: include/linux/ceph/
F: include/linux/crush/ F: include/linux/crush/
CEPH DISTRIBUTED FILE SYSTEM CLIENT (CEPH)
M: "Yan, Zheng" <zyan@redhat.com>
M: Sage Weil <sage@redhat.com>
M: Ilya Dryomov <idryomov@gmail.com>
L: ceph-devel@vger.kernel.org
W: http://ceph.com/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
T: git git://github.com/ceph/ceph-client.git
S: Supported
F: Documentation/filesystems/ceph.txt
F: fs/ceph/
CERTIFIED WIRELESS USB (WUSB) SUBSYSTEM: CERTIFIED WIRELESS USB (WUSB) SUBSYSTEM:
L: linux-usb@vger.kernel.org L: linux-usb@vger.kernel.org
S: Orphan S: Orphan
...@@ -8366,10 +8378,12 @@ RADOS BLOCK DEVICE (RBD) ...@@ -8366,10 +8378,12 @@ RADOS BLOCK DEVICE (RBD)
M: Ilya Dryomov <idryomov@gmail.com> M: Ilya Dryomov <idryomov@gmail.com>
M: Sage Weil <sage@redhat.com> M: Sage Weil <sage@redhat.com>
M: Alex Elder <elder@kernel.org> M: Alex Elder <elder@kernel.org>
M: ceph-devel@vger.kernel.org L: ceph-devel@vger.kernel.org
W: http://ceph.com/ W: http://ceph.com/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
T: git git://github.com/ceph/ceph-client.git
S: Supported S: Supported
F: Documentation/ABI/testing/sysfs-bus-rbd
F: drivers/block/rbd.c F: drivers/block/rbd.c
F: drivers/block/rbd_types.h F: drivers/block/rbd_types.h
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/radix-tree.h> #include <linux/radix-tree.h>
#include <linux/uio.h> #include <linux/uio.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <net/net_namespace.h>
#include <linux/ceph/types.h> #include <linux/ceph/types.h>
#include <linux/ceph/buffer.h> #include <linux/ceph/buffer.h>
...@@ -56,6 +57,7 @@ struct ceph_messenger { ...@@ -56,6 +57,7 @@ struct ceph_messenger {
struct ceph_entity_addr my_enc_addr; struct ceph_entity_addr my_enc_addr;
atomic_t stopping; atomic_t stopping;
possible_net_t net;
bool nocrc; bool nocrc;
bool tcp_nodelay; bool tcp_nodelay;
...@@ -267,6 +269,7 @@ extern void ceph_messenger_init(struct ceph_messenger *msgr, ...@@ -267,6 +269,7 @@ extern void ceph_messenger_init(struct ceph_messenger *msgr,
u64 required_features, u64 required_features,
bool nocrc, bool nocrc,
bool tcp_nodelay); bool tcp_nodelay);
extern void ceph_messenger_fini(struct ceph_messenger *msgr);
extern void ceph_con_init(struct ceph_connection *con, void *private, extern void ceph_con_init(struct ceph_connection *con, void *private,
const struct ceph_connection_operations *ops, const struct ceph_connection_operations *ops,
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <keys/ceph-type.h> #include <keys/ceph-type.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/nsproxy.h>
#include <linux/parser.h> #include <linux/parser.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
...@@ -16,8 +17,6 @@ ...@@ -16,8 +17,6 @@
#include <linux/statfs.h> #include <linux/statfs.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <linux/nsproxy.h>
#include <net/net_namespace.h>
#include <linux/ceph/ceph_features.h> #include <linux/ceph/ceph_features.h>
...@@ -131,6 +130,13 @@ int ceph_compare_options(struct ceph_options *new_opt, ...@@ -131,6 +130,13 @@ int ceph_compare_options(struct ceph_options *new_opt,
int i; int i;
int ret; int ret;
/*
* Don't bother comparing options if network namespaces don't
* match.
*/
if (!net_eq(current->nsproxy->net_ns, read_pnet(&client->msgr.net)))
return -1;
ret = memcmp(opt1, opt2, ofs); ret = memcmp(opt1, opt2, ofs);
if (ret) if (ret)
return ret; return ret;
...@@ -335,9 +341,6 @@ ceph_parse_options(char *options, const char *dev_name, ...@@ -335,9 +341,6 @@ ceph_parse_options(char *options, const char *dev_name,
int err = -ENOMEM; int err = -ENOMEM;
substring_t argstr[MAX_OPT_ARGS]; substring_t argstr[MAX_OPT_ARGS];
if (current->nsproxy->net_ns != &init_net)
return ERR_PTR(-EINVAL);
opt = kzalloc(sizeof(*opt), GFP_KERNEL); opt = kzalloc(sizeof(*opt), GFP_KERNEL);
if (!opt) if (!opt)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -608,6 +611,7 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private, ...@@ -608,6 +611,7 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private,
fail_monc: fail_monc:
ceph_monc_stop(&client->monc); ceph_monc_stop(&client->monc);
fail: fail:
ceph_messenger_fini(&client->msgr);
kfree(client); kfree(client);
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -621,8 +625,8 @@ void ceph_destroy_client(struct ceph_client *client) ...@@ -621,8 +625,8 @@ void ceph_destroy_client(struct ceph_client *client)
/* unmount */ /* unmount */
ceph_osdc_stop(&client->osdc); ceph_osdc_stop(&client->osdc);
ceph_monc_stop(&client->monc); ceph_monc_stop(&client->monc);
ceph_messenger_fini(&client->msgr);
ceph_debugfs_client_cleanup(client); ceph_debugfs_client_cleanup(client);
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/inet.h> #include <linux/inet.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/net.h> #include <linux/net.h>
#include <linux/nsproxy.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/socket.h> #include <linux/socket.h>
#include <linux/string.h> #include <linux/string.h>
...@@ -479,7 +480,7 @@ static int ceph_tcp_connect(struct ceph_connection *con) ...@@ -479,7 +480,7 @@ static int ceph_tcp_connect(struct ceph_connection *con)
int ret; int ret;
BUG_ON(con->sock); BUG_ON(con->sock);
ret = sock_create_kern(&init_net, con->peer_addr.in_addr.ss_family, ret = sock_create_kern(read_pnet(&con->msgr->net), paddr->ss_family,
SOCK_STREAM, IPPROTO_TCP, &sock); SOCK_STREAM, IPPROTO_TCP, &sock);
if (ret) if (ret)
return ret; return ret;
...@@ -1731,17 +1732,17 @@ static int verify_hello(struct ceph_connection *con) ...@@ -1731,17 +1732,17 @@ static int verify_hello(struct ceph_connection *con)
static bool addr_is_blank(struct sockaddr_storage *ss) static bool addr_is_blank(struct sockaddr_storage *ss)
{ {
struct in_addr *addr = &((struct sockaddr_in *)ss)->sin_addr;
struct in6_addr *addr6 = &((struct sockaddr_in6 *)ss)->sin6_addr;
switch (ss->ss_family) { switch (ss->ss_family) {
case AF_INET: case AF_INET:
return ((struct sockaddr_in *)ss)->sin_addr.s_addr == 0; return addr->s_addr == htonl(INADDR_ANY);
case AF_INET6: case AF_INET6:
return return ipv6_addr_any(addr6);
((struct sockaddr_in6 *)ss)->sin6_addr.s6_addr32[0] == 0 && default:
((struct sockaddr_in6 *)ss)->sin6_addr.s6_addr32[1] == 0 && return true;
((struct sockaddr_in6 *)ss)->sin6_addr.s6_addr32[2] == 0 &&
((struct sockaddr_in6 *)ss)->sin6_addr.s6_addr32[3] == 0;
} }
return false;
} }
static int addr_port(struct sockaddr_storage *ss) static int addr_port(struct sockaddr_storage *ss)
...@@ -2944,11 +2945,18 @@ void ceph_messenger_init(struct ceph_messenger *msgr, ...@@ -2944,11 +2945,18 @@ void ceph_messenger_init(struct ceph_messenger *msgr,
msgr->tcp_nodelay = tcp_nodelay; msgr->tcp_nodelay = tcp_nodelay;
atomic_set(&msgr->stopping, 0); atomic_set(&msgr->stopping, 0);
write_pnet(&msgr->net, get_net(current->nsproxy->net_ns));
dout("%s %p\n", __func__, msgr); dout("%s %p\n", __func__, msgr);
} }
EXPORT_SYMBOL(ceph_messenger_init); EXPORT_SYMBOL(ceph_messenger_init);
void ceph_messenger_fini(struct ceph_messenger *msgr)
{
put_net(read_pnet(&msgr->net));
}
EXPORT_SYMBOL(ceph_messenger_fini);
static void clear_standby(struct ceph_connection *con) static void clear_standby(struct ceph_connection *con)
{ {
/* come back from STANDBY? */ /* come back from STANDBY? */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册