From dc6f55e9f8dac4b6479be67c5c9128ad37bb491f Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 25 Oct 2011 10:25:49 +1100 Subject: NFS/sunrpc: don't use a credential with extra groups. The sunrpc layer keeps a cache of recently used credentials and 'unx_match' is used to find the credential which matches the current process. However unx_match allows a match when the cached credential has extra groups at the end of uc_gids list which are not in the process group list. So if a process with a list of (say) 4 group accesses a file and gains access because of the last group in the list, then another process with the same uid and gid, and a gid list being the first tree of the gids of the original process tries to access the file, it will be granted access even though it shouldn't as the wrong rpc credential will be used. Signed-off-by: NeilBrown Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org --- net/sunrpc/auth_unix.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'net') diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index 4cb70dc6e7ad..e50502d8ceb7 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c @@ -129,6 +129,9 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags) for (i = 0; i < groups ; i++) if (cred->uc_gids[i] != GROUP_AT(acred->group_info, i)) return 0; + if (groups < NFS_NGROUPS && + cred->uc_gids[groups] != NOGROUP) + return 0; return 1; } -- cgit v1.2.3 From 914edb1bb2abe2ae4775368f2ffb7f41010fb81e Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Tue, 25 Oct 2011 14:16:36 +0300 Subject: SUNRPC: introduce helpers for reference counted rpcbind clients v6: 1) added write memory barrier to rpcb_set_local to make sure, that rpcbind clients become valid before rpcb_users assignment 2) explicitly set rpcb_users to 1 instead of incrementing it (looks clearer from my pow). v5: fixed races with rpcb_users in rpcb_get_local() This helpers will be used for dynamical creation and destruction of rpcbind clients. Variable rpcb_users is actually a counter of lauched RPC services. If rpcbind clients has been created already, then we just increase rpcb_users. Signed-off-by: Stanislav Kinsbursky Signed-off-by: Trond Myklebust --- net/sunrpc/rpcb_clnt.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'net') diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index f588b852d41c..78af56579fa1 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -114,6 +114,9 @@ static struct rpc_program rpcb_program; static struct rpc_clnt * rpcb_local_clnt; static struct rpc_clnt * rpcb_local_clnt4; +DEFINE_SPINLOCK(rpcb_clnt_lock); +unsigned int rpcb_users; + struct rpcbind_args { struct rpc_xprt * r_xprt; @@ -161,6 +164,56 @@ static void rpcb_map_release(void *data) kfree(map); } +static int rpcb_get_local(void) +{ + int cnt; + + spin_lock(&rpcb_clnt_lock); + if (rpcb_users) + rpcb_users++; + cnt = rpcb_users; + spin_unlock(&rpcb_clnt_lock); + + return cnt; +} + +void rpcb_put_local(void) +{ + struct rpc_clnt *clnt = rpcb_local_clnt; + struct rpc_clnt *clnt4 = rpcb_local_clnt4; + int shutdown; + + spin_lock(&rpcb_clnt_lock); + if (--rpcb_users == 0) { + rpcb_local_clnt = NULL; + rpcb_local_clnt4 = NULL; + } + shutdown = !rpcb_users; + spin_unlock(&rpcb_clnt_lock); + + if (shutdown) { + /* + * cleanup_rpcb_clnt - remove xprtsock's sysctls, unregister + */ + if (clnt4) + rpc_shutdown_client(clnt4); + if (clnt) + rpc_shutdown_client(clnt); + } +} + +static void rpcb_set_local(struct rpc_clnt *clnt, struct rpc_clnt *clnt4) +{ + /* Protected by rpcb_create_local_mutex */ + rpcb_local_clnt = clnt; + rpcb_local_clnt4 = clnt4; + smp_wmb(); + rpcb_users = 1; + dprintk("RPC: created new rpcb local clients (rpcb_local_clnt: " + "%p, rpcb_local_clnt4: %p)\n", rpcb_local_clnt, + rpcb_local_clnt4); +} + /* * Returns zero on success, otherwise a negative errno value * is returned. -- cgit v1.2.3 From 253fb070e78db981740b000914b04b9203092925 Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Tue, 25 Oct 2011 14:16:48 +0300 Subject: SUNRPC: use rpcbind reference counting helpers All is simple: we just increase users counter if rpcbind clients has been created already. Otherwise we create them and set users counter to 1. Signed-off-by: Stanislav Kinsbursky Signed-off-by: Trond Myklebust --- net/sunrpc/rpcb_clnt.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'net') diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 78af56579fa1..f5309aba1a14 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -258,9 +258,7 @@ static int rpcb_create_local_unix(void) clnt4 = NULL; } - /* Protected by rpcb_create_local_mutex */ - rpcb_local_clnt = clnt; - rpcb_local_clnt4 = clnt4; + rpcb_set_local(clnt, clnt4); out: return result; @@ -312,9 +310,7 @@ static int rpcb_create_local_net(void) clnt4 = NULL; } - /* Protected by rpcb_create_local_mutex */ - rpcb_local_clnt = clnt; - rpcb_local_clnt4 = clnt4; + rpcb_set_local(clnt, clnt4); out: return result; @@ -329,11 +325,11 @@ static int rpcb_create_local(void) static DEFINE_MUTEX(rpcb_create_local_mutex); int result = 0; - if (rpcb_local_clnt) + if (rpcb_get_local()) return result; mutex_lock(&rpcb_create_local_mutex); - if (rpcb_local_clnt) + if (rpcb_get_local()) goto out; if (rpcb_create_local_unix() != 0) -- cgit v1.2.3 From d99085605cd245d8f24858e9d0b06013e13aa044 Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Tue, 25 Oct 2011 14:16:58 +0300 Subject: SUNRPC: introduce svc helpers for prepairing rpcbind infrastructure This helpers will be used only for those services, that will send portmapper registration calls. Signed-off-by: Stanislav Kinsbursky Signed-off-by: Trond Myklebust --- net/sunrpc/rpcb_clnt.c | 2 +- net/sunrpc/svc.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) (limited to 'net') diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index f5309aba1a14..c24626537a7d 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -320,7 +320,7 @@ out: * Returns zero on success, otherwise a negative errno value * is returned. */ -static int rpcb_create_local(void) +int rpcb_create_local(void) { static DEFINE_MUTEX(rpcb_create_local_mutex); int result = 0; diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 6a69a1131fb7..d2d61bfa3306 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -354,6 +354,41 @@ svc_pool_for_cpu(struct svc_serv *serv, int cpu) return &serv->sv_pools[pidx % serv->sv_nrpools]; } +static int svc_rpcb_setup(struct svc_serv *serv) +{ + int err; + + err = rpcb_create_local(); + if (err) + return err; + + /* Remove any stale portmap registrations */ + svc_unregister(serv); + return 0; +} + +static void svc_rpcb_cleanup(struct svc_serv *serv) +{ + svc_unregister(serv); + rpcb_put_local(); +} + +static int svc_uses_rpcbind(struct svc_serv *serv) +{ + struct svc_program *progp; + unsigned int i; + + for (progp = serv->sv_program; progp; progp = progp->pg_next) { + for (i = 0; i < progp->pg_nvers; i++) { + if (progp->pg_vers[i] == NULL) + continue; + if (progp->pg_vers[i]->vs_hidden == 0) + return 1; + } + } + + return 0; +} /* * Create an RPC service -- cgit v1.2.3 From e40f5e29ef0909ecba1d759cc930efb7a9a7d935 Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Tue, 25 Oct 2011 14:17:08 +0300 Subject: SUNRPC: setup rpcbind clients if service requires it New function ("svc_uses_rpcbind") will be used to detect, that new service will send portmapper register calls. For such services we will create rpcbind clients and remove all stale portmap registrations. Also, svc_rpcb_cleanup() will be set as sv_shutdown callback for such services in case of this field wasn't initialized earlier. This will allow to destroy rpcbind clients when no other users of them left. Note: Currently, any creating service will be detected as portmap user. Probably, this is wrong. But now it depends on program versions "vs_hidden" flag. Signed-off-by: Stanislav Kinsbursky Signed-off-by: Trond Myklebust --- net/sunrpc/svc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'net') diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index d2d61bfa3306..918edc310fd1 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -454,8 +454,15 @@ __svc_create(struct svc_program *prog, unsigned int bufsize, int npools, spin_lock_init(&pool->sp_lock); } - /* Remove any stale portmap registrations */ - svc_unregister(serv); + if (svc_uses_rpcbind(serv)) { + if (svc_rpcb_setup(serv) < 0) { + kfree(serv->sv_pools); + kfree(serv); + return NULL; + } + if (!serv->sv_shutdown) + serv->sv_shutdown = svc_rpcb_cleanup; + } return serv; } -- cgit v1.2.3 From 8e356b1e2a888c59d10a4842995a3273ca2d9086 Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Tue, 25 Oct 2011 14:17:18 +0300 Subject: SUNRPC: cleanup service destruction svc_unregister() call have to be removed from svc_destroy() since it will be called in sv_shutdown callback. Signed-off-by: Stanislav Kinsbursky Signed-off-by: Trond Myklebust --- net/sunrpc/svc.c | 1 - 1 file changed, 1 deletion(-) (limited to 'net') diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 918edc310fd1..407462ff4779 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -530,7 +530,6 @@ svc_destroy(struct svc_serv *serv) if (svc_serv_is_pooled(serv)) svc_pool_map_put(); - svc_unregister(serv); kfree(serv->sv_pools); kfree(serv); } -- cgit v1.2.3 From 16d0587090ab93206768f726f71d84ecf55e05c4 Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Tue, 25 Oct 2011 14:17:28 +0300 Subject: NFSd: call svc rpcbind cleanup explicitly We have to call svc_rpcb_cleanup() explicitly from nfsd_last_thread() since this function is registered as service shutdown callback and thus nobody else will done it for us. Signed-off-by: Stanislav Kinsbursky Signed-off-by: Trond Myklebust --- net/sunrpc/svc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'net') diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 407462ff4779..252552a685dc 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -367,11 +367,12 @@ static int svc_rpcb_setup(struct svc_serv *serv) return 0; } -static void svc_rpcb_cleanup(struct svc_serv *serv) +void svc_rpcb_cleanup(struct svc_serv *serv) { svc_unregister(serv); rpcb_put_local(); } +EXPORT_SYMBOL_GPL(svc_rpcb_cleanup); static int svc_uses_rpcbind(struct svc_serv *serv) { -- cgit v1.2.3 From 0f0c01da444fbfd63556f301dde15915fd6cbb20 Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Tue, 25 Oct 2011 14:17:38 +0300 Subject: SUNRPC: remove rpcbind clients creation during service registering We don't need this code since rpcbind clients are creating during RPC service creation. Signed-off-by: Stanislav Kinsbursky Signed-off-by: Trond Myklebust --- net/sunrpc/rpcb_clnt.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'net') diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index c24626537a7d..e913039133a9 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -431,11 +431,6 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port) struct rpc_message msg = { .rpc_argp = &map, }; - int error; - - error = rpcb_create_local(); - if (error) - return error; dprintk("RPC: %sregistering (%u, %u, %d, %u) with local " "rpcbind\n", (port ? "" : "un"), @@ -571,11 +566,7 @@ int rpcb_v4_register(const u32 program, const u32 version, struct rpc_message msg = { .rpc_argp = &map, }; - int error; - error = rpcb_create_local(); - if (error) - return error; if (rpcb_local_clnt4 == NULL) return -EPROTONOSUPPORT; -- cgit v1.2.3 From e20de377578e9504f8467c05ab1db98b4935d4ed Mon Sep 17 00:00:00 2001 From: Stanislav Kinsbursky Date: Tue, 25 Oct 2011 14:17:48 +0300 Subject: SUNRPC: remove rpcbind clients destruction on module cleanup Rpcbind clients destruction during SUNRPC module removing is obsolete since now those clients are destroying during last RPC service shutdown. Signed-off-by: Stanislav Kinsbursky Signed-off-by: Trond Myklebust --- net/sunrpc/rpcb_clnt.c | 12 ------------ net/sunrpc/sunrpc_syms.c | 3 --- 2 files changed, 15 deletions(-) (limited to 'net') diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index e913039133a9..8761bf8e36fc 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -1100,15 +1100,3 @@ static struct rpc_program rpcb_program = { .version = rpcb_version, .stats = &rpcb_stats, }; - -/** - * cleanup_rpcb_clnt - remove xprtsock's sysctls, unregister - * - */ -void cleanup_rpcb_clnt(void) -{ - if (rpcb_local_clnt4) - rpc_shutdown_client(rpcb_local_clnt4); - if (rpcb_local_clnt) - rpc_shutdown_client(rpcb_local_clnt); -} diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c index 9d0809160994..8ec9778c3f4a 100644 --- a/net/sunrpc/sunrpc_syms.c +++ b/net/sunrpc/sunrpc_syms.c @@ -61,8 +61,6 @@ static struct pernet_operations sunrpc_net_ops = { extern struct cache_detail unix_gid_cache; -extern void cleanup_rpcb_clnt(void); - static int __init init_sunrpc(void) { @@ -102,7 +100,6 @@ out: static void __exit cleanup_sunrpc(void) { - cleanup_rpcb_clnt(); rpcauth_remove_module(); cleanup_socket_xprt(); svc_cleanup_xprt_sock(); -- cgit v1.2.3 From 6ab00d465a1c8c02c2216f8220727282f3aa50b5 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 9 Aug 2011 09:41:59 -0700 Subject: libceph: create messenger with client This simplifies the init/shutdown paths, and makes client->msgr available during the rest of the setup process. Signed-off-by: Sage Weil --- net/ceph/ceph_common.c | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'net') diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 2883ea01e680..97f70e50ad3b 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c @@ -432,9 +432,12 @@ EXPORT_SYMBOL(ceph_client_id); /* * create a fresh client instance */ -struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) +struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private, + unsigned supported_features, + unsigned required_features) { struct ceph_client *client; + struct ceph_entity_addr *myaddr = NULL; int err = -ENOMEM; client = kzalloc(sizeof(*client), GFP_KERNEL); @@ -449,15 +452,27 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) client->auth_err = 0; client->extra_mon_dispatch = NULL; - client->supported_features = CEPH_FEATURE_SUPPORTED_DEFAULT; - client->required_features = CEPH_FEATURE_REQUIRED_DEFAULT; - - client->msgr = NULL; + client->supported_features = CEPH_FEATURE_SUPPORTED_DEFAULT | + supported_features; + client->required_features = CEPH_FEATURE_REQUIRED_DEFAULT | + required_features; + + /* msgr */ + if (ceph_test_opt(client, MYIP)) + myaddr = &client->options->my_addr; + client->msgr = ceph_messenger_create(myaddr, + client->supported_features, + client->required_features); + if (IS_ERR(client->msgr)) { + err = PTR_ERR(client->msgr); + goto fail; + } + client->msgr->nocrc = ceph_test_opt(client, NOCRC); /* subsystems */ err = ceph_monc_init(&client->monc, client); if (err < 0) - goto fail; + goto fail_msgr; err = ceph_osdc_init(&client->osdc, client); if (err < 0) goto fail_monc; @@ -466,6 +481,8 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) fail_monc: ceph_monc_stop(&client->monc); +fail_msgr: + ceph_messenger_destroy(client->msgr); fail: kfree(client); return ERR_PTR(err); @@ -490,8 +507,7 @@ void ceph_destroy_client(struct ceph_client *client) ceph_debugfs_client_cleanup(client); - if (client->msgr) - ceph_messenger_destroy(client->msgr); + ceph_messenger_destroy(client->msgr); ceph_destroy_options(client->options); @@ -514,24 +530,9 @@ static int have_mon_and_osd_map(struct ceph_client *client) */ int __ceph_open_session(struct ceph_client *client, unsigned long started) { - struct ceph_entity_addr *myaddr = NULL; int err; unsigned long timeout = client->options->mount_timeout * HZ; - /* initialize the messenger */ - if (client->msgr == NULL) { - if (ceph_test_opt(client, MYIP)) - myaddr = &client->options->my_addr; - client->msgr = ceph_messenger_create(myaddr, - client->supported_features, - client->required_features); - if (IS_ERR(client->msgr)) { - client->msgr = NULL; - return PTR_ERR(client->msgr); - } - client->msgr->nocrc = ceph_test_opt(client, NOCRC); - } - /* open session, and wait for mon and osd maps */ err = ceph_monc_open_session(&client->monc); if (err < 0) -- cgit v1.2.3 From f6a2f5be07463ef532b9f4e3cb9e42ab9df85832 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 9 Aug 2011 09:27:44 -0700 Subject: libceph: always preallocate mon connection Allocate the mon connection on init. We already reuse it across reconnects. Remove now unnecessary (and incomplete) NULL checks. Signed-off-by: Sage Weil --- net/ceph/mon_client.c | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) (limited to 'net') diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index cbe31fa45508..556721665335 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c @@ -116,14 +116,12 @@ static void __send_prepared_auth_request(struct ceph_mon_client *monc, int len) */ static void __close_session(struct ceph_mon_client *monc) { - if (monc->con) { - dout("__close_session closing mon%d\n", monc->cur_mon); - ceph_con_revoke(monc->con, monc->m_auth); - ceph_con_close(monc->con); - monc->cur_mon = -1; - monc->pending_auth = 0; - ceph_auth_reset(monc->auth); - } + dout("__close_session closing mon%d\n", monc->cur_mon); + ceph_con_revoke(monc->con, monc->m_auth); + ceph_con_close(monc->con); + monc->cur_mon = -1; + monc->pending_auth = 0; + ceph_auth_reset(monc->auth); } /* @@ -302,15 +300,6 @@ void ceph_monc_request_next_osdmap(struct ceph_mon_client *monc) */ int ceph_monc_open_session(struct ceph_mon_client *monc) { - if (!monc->con) { - monc->con = kmalloc(sizeof(*monc->con), GFP_KERNEL); - if (!monc->con) - return -ENOMEM; - ceph_con_init(monc->client->msgr, monc->con); - monc->con->private = monc; - monc->con->ops = &mon_con_ops; - } - mutex_lock(&monc->mutex); __open_session(monc); __schedule_delayed(monc); @@ -755,7 +744,13 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl) if (err) goto out; - monc->con = NULL; + /* connection */ + monc->con = kmalloc(sizeof(*monc->con), GFP_KERNEL); + if (!monc->con) + goto out_monmap; + ceph_con_init(monc->client->msgr, monc->con); + monc->con->private = monc; + monc->con->ops = &mon_con_ops; /* authentication */ monc->auth = ceph_auth_init(cl->options->name, @@ -772,7 +767,7 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl) sizeof(struct ceph_mon_subscribe_ack), GFP_NOFS); if (!monc->m_subscribe_ack) - goto out_monmap; + goto out_con; monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS); if (!monc->m_subscribe) @@ -808,6 +803,8 @@ out_subscribe: ceph_msg_put(monc->m_subscribe); out_subscribe_ack: ceph_msg_put(monc->m_subscribe_ack); +out_con: + monc->con->ops->put(monc->con); out_monmap: kfree(monc->monmap); out: @@ -822,11 +819,11 @@ void ceph_monc_stop(struct ceph_mon_client *monc) mutex_lock(&monc->mutex); __close_session(monc); - if (monc->con) { - monc->con->private = NULL; - monc->con->ops->put(monc->con); - monc->con = NULL; - } + + monc->con->private = NULL; + monc->con->ops->put(monc->con); + monc->con = NULL; + mutex_unlock(&monc->mutex); ceph_auth_destroy(monc->auth); @@ -1000,7 +997,7 @@ static void mon_fault(struct ceph_connection *con) if (!con->private) goto out; - if (monc->con && !monc->hunting) + if (!monc->hunting) pr_info("mon%d %s session lost, " "hunting for new mon\n", monc->cur_mon, ceph_pr_addr(&monc->con->peer_addr.in_addr)); -- cgit v1.2.3 From b61c27636fffbaf1980e675282777b9467254a40 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 9 Aug 2011 15:03:46 -0700 Subject: libceph: don't complain on msgpool alloc failures The pool allocation failures are masked by the pool; there is no need to spam the console about them. (That's the whole point of having the pool in the first place.) Mark msg allocations whose failure is safely handled as such. Signed-off-by: Sage Weil --- net/ceph/messenger.c | 15 +++++++++++---- net/ceph/mon_client.c | 24 +++++++++++++++--------- net/ceph/msgpool.c | 4 ++-- net/ceph/osd_client.c | 8 ++++---- 4 files changed, 32 insertions(+), 19 deletions(-) (limited to 'net') diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 9918e9eb276e..2de711a0c037 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -2281,7 +2281,8 @@ EXPORT_SYMBOL(ceph_con_keepalive); * construct a new message with given type, size * the new msg has a ref count of 1. */ -struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags) +struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, + bool can_fail) { struct ceph_msg *m; @@ -2333,7 +2334,7 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags) m->front.iov_base = kmalloc(front_len, flags); } if (m->front.iov_base == NULL) { - pr_err("msg_new can't allocate %d bytes\n", + dout("ceph_msg_new can't allocate %d bytes\n", front_len); goto out2; } @@ -2348,7 +2349,13 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags) out2: ceph_msg_put(m); out: - pr_err("msg_new can't create type %d front %d\n", type, front_len); + if (!can_fail) { + pr_err("msg_new can't create type %d front %d\n", type, + front_len); + } else { + dout("msg_new can't create type %d front %d\n", type, + front_len); + } return NULL; } EXPORT_SYMBOL(ceph_msg_new); @@ -2398,7 +2405,7 @@ static struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con, } if (!msg) { *skip = 0; - msg = ceph_msg_new(type, front_len, GFP_NOFS); + msg = ceph_msg_new(type, front_len, GFP_NOFS, false); if (!msg) { pr_err("unable to allocate msg type %d len %d\n", type, front_len); diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 556721665335..af2ef3082499 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c @@ -517,10 +517,12 @@ int ceph_monc_do_statfs(struct ceph_mon_client *monc, struct ceph_statfs *buf) init_completion(&req->completion); err = -ENOMEM; - req->request = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), GFP_NOFS); + req->request = ceph_msg_new(CEPH_MSG_STATFS, sizeof(*h), GFP_NOFS, + true); if (!req->request) goto out; - req->reply = ceph_msg_new(CEPH_MSG_STATFS_REPLY, 1024, GFP_NOFS); + req->reply = ceph_msg_new(CEPH_MSG_STATFS_REPLY, 1024, GFP_NOFS, + true); if (!req->reply) goto out; @@ -615,10 +617,12 @@ int ceph_monc_do_poolop(struct ceph_mon_client *monc, u32 op, init_completion(&req->completion); err = -ENOMEM; - req->request = ceph_msg_new(CEPH_MSG_POOLOP, sizeof(*h), GFP_NOFS); + req->request = ceph_msg_new(CEPH_MSG_POOLOP, sizeof(*h), GFP_NOFS, + true); if (!req->request) goto out; - req->reply = ceph_msg_new(CEPH_MSG_POOLOP_REPLY, 1024, GFP_NOFS); + req->reply = ceph_msg_new(CEPH_MSG_POOLOP_REPLY, 1024, GFP_NOFS, + true); if (!req->reply) goto out; @@ -765,19 +769,21 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl) err = -ENOMEM; monc->m_subscribe_ack = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE_ACK, sizeof(struct ceph_mon_subscribe_ack), - GFP_NOFS); + GFP_NOFS, true); if (!monc->m_subscribe_ack) goto out_con; - monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS); + monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS, + true); if (!monc->m_subscribe) goto out_subscribe_ack; - monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096, GFP_NOFS); + monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096, GFP_NOFS, + true); if (!monc->m_auth_reply) goto out_subscribe; - monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, GFP_NOFS); + monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, GFP_NOFS, true); monc->pending_auth = 0; if (!monc->m_auth) goto out_auth_reply; @@ -970,7 +976,7 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con, case CEPH_MSG_MON_MAP: case CEPH_MSG_MDS_MAP: case CEPH_MSG_OSD_MAP: - m = ceph_msg_new(type, front_len, GFP_NOFS); + m = ceph_msg_new(type, front_len, GFP_NOFS, false); break; } diff --git a/net/ceph/msgpool.c b/net/ceph/msgpool.c index 1f4cb30a42c5..11d5f4196a73 100644 --- a/net/ceph/msgpool.c +++ b/net/ceph/msgpool.c @@ -12,7 +12,7 @@ static void *msgpool_alloc(gfp_t gfp_mask, void *arg) struct ceph_msgpool *pool = arg; struct ceph_msg *msg; - msg = ceph_msg_new(0, pool->front_len, gfp_mask); + msg = ceph_msg_new(0, pool->front_len, gfp_mask, true); if (!msg) { dout("msgpool_alloc %s failed\n", pool->name); } else { @@ -61,7 +61,7 @@ struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool, WARN_ON(1); /* try to alloc a fresh message */ - return ceph_msg_new(0, front_len, GFP_NOFS); + return ceph_msg_new(0, front_len, GFP_NOFS, false); } msg = mempool_alloc(pool->pool, GFP_NOFS); diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 88ad8a2501b5..01ceb59a8b4a 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -227,7 +227,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, msg = ceph_msgpool_get(&osdc->msgpool_op_reply, 0); else msg = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, - OSD_OPREPLY_FRONT_LEN, gfp_flags); + OSD_OPREPLY_FRONT_LEN, gfp_flags, true); if (!msg) { ceph_osdc_put_request(req); return NULL; @@ -250,7 +250,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, if (use_mempool) msg = ceph_msgpool_get(&osdc->msgpool_op, 0); else - msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, gfp_flags); + msg = ceph_msg_new(CEPH_MSG_OSD_OP, msg_size, gfp_flags, true); if (!msg) { ceph_osdc_put_request(req); return NULL; @@ -2032,7 +2032,7 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, if (front > req->r_reply->front.iov_len) { pr_warning("get_reply front %d > preallocated %d\n", front, (int)req->r_reply->front.iov_len); - m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front, GFP_NOFS); + m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front, GFP_NOFS, false); if (!m) goto out; ceph_msg_put(req->r_reply); @@ -2080,7 +2080,7 @@ static struct ceph_msg *alloc_msg(struct ceph_connection *con, switch (type) { case CEPH_MSG_OSD_MAP: case CEPH_MSG_WATCH_NOTIFY: - return ceph_msg_new(type, front, GFP_NOFS); + return ceph_msg_new(type, front, GFP_NOFS, false); case CEPH_MSG_OSD_OPREPLY: return get_reply(con, hdr, skip); default: -- cgit v1.2.3 From f0ed1b7cef1e801ef470efc501f9c663fe10cebd Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 9 Aug 2011 15:05:07 -0700 Subject: libceph: warn on msg allocation failures Any non-masked msg allocation failure should generate a warning and stack trace to the console. All of these need to eventually be replaced by safe preallocation or msgpools. Signed-off-by: Sage Weil --- net/ceph/messenger.c | 1 + 1 file changed, 1 insertion(+) (limited to 'net') diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 2de711a0c037..f56aca302617 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -2352,6 +2352,7 @@ out: if (!can_fail) { pr_err("msg_new can't create type %d front %d\n", type, front_len); + WARN_ON(1); } else { dout("msg_new can't create type %d front %d\n", type, front_len); -- cgit v1.2.3 From 49d9224c047f23089c49a6749609447abd09ee03 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Mon, 12 Sep 2011 14:51:58 -0700 Subject: ceph: fix ceph_monc_init memory leak failure clean up does not consider ceph_auth_init. Signed-off-by: Noah Watkins Signed-off-by: Sage Weil --- net/ceph/mon_client.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'net') diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index af2ef3082499..0b62deae42bd 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c @@ -759,8 +759,10 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl) /* authentication */ monc->auth = ceph_auth_init(cl->options->name, cl->options->key); - if (IS_ERR(monc->auth)) - return PTR_ERR(monc->auth); + if (IS_ERR(monc->auth)) { + err = PTR_ERR(monc->auth); + goto out_con; + } monc->auth->want_keys = CEPH_ENTITY_TYPE_AUTH | CEPH_ENTITY_TYPE_MON | CEPH_ENTITY_TYPE_OSD | CEPH_ENTITY_TYPE_MDS; @@ -771,7 +773,7 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl) sizeof(struct ceph_mon_subscribe_ack), GFP_NOFS, true); if (!monc->m_subscribe_ack) - goto out_con; + goto out_auth; monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 96, GFP_NOFS, true); @@ -809,6 +811,8 @@ out_subscribe: ceph_msg_put(monc->m_subscribe); out_subscribe_ack: ceph_msg_put(monc->m_subscribe_ack); +out_auth: + ceph_auth_destroy(monc->auth); out_con: monc->con->ops->put(monc->con); out_monmap: -- cgit v1.2.3 From ee3b56f265cafb28c9a1b58faed4f1dbdf51af86 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Fri, 23 Sep 2011 11:48:42 -0700 Subject: ceph: use kernel DNS resolver Change ceph_parse_ips to take either names given as IP addresses or standard hostnames (e.g. localhost). The DNS lookup is done using the dns_resolver facility similar to its use in AFS, NFS, and CIFS. This patch defines CONFIG_CEPH_LIB_USE_DNS_RESOLVER that controls if this feature is on or off. Signed-off-by: Noah Watkins Signed-off-by: Sage Weil --- net/ceph/Kconfig | 14 +++++++ net/ceph/messenger.c | 114 +++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 116 insertions(+), 12 deletions(-) (limited to 'net') diff --git a/net/ceph/Kconfig b/net/ceph/Kconfig index be683f2d401f..cc04dd667a10 100644 --- a/net/ceph/Kconfig +++ b/net/ceph/Kconfig @@ -27,3 +27,17 @@ config CEPH_LIB_PRETTYDEBUG If unsure, say N. +config CEPH_LIB_USE_DNS_RESOLVER + bool "Use in-kernel support for DNS lookup" + depends on CEPH_LIB + select DNS_RESOLVER + default n + help + If you say Y here, hostnames (e.g. monitor addresses) will + be resolved using the CONFIG_DNS_RESOLVER facility. + + For information on how to use CONFIG_DNS_RESOLVER consult + Documentation/networking/dns_resolver.txt + + If unsure, say N. + diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index f56aca302617..f466930e26fa 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -1077,6 +1078,101 @@ static void addr_set_port(struct sockaddr_storage *ss, int p) } } +/* + * Unlike other *_pton function semantics, zero indicates success. + */ +static int ceph_pton(const char *str, size_t len, struct sockaddr_storage *ss, + char delim, const char **ipend) +{ + struct sockaddr_in *in4 = (void *)ss; + struct sockaddr_in6 *in6 = (void *)ss; + + memset(ss, 0, sizeof(*ss)); + + if (in4_pton(str, len, (u8 *)&in4->sin_addr.s_addr, delim, ipend)) { + ss->ss_family = AF_INET; + return 0; + } + + if (in6_pton(str, len, (u8 *)&in6->sin6_addr.s6_addr, delim, ipend)) { + ss->ss_family = AF_INET6; + return 0; + } + + return -EINVAL; +} + +/* + * Extract hostname string and resolve using kernel DNS facility. + */ +#ifdef CONFIG_CEPH_LIB_USE_DNS_RESOLVER +static int ceph_dns_resolve_name(const char *name, size_t namelen, + struct sockaddr_storage *ss, char delim, const char **ipend) +{ + const char *end, *delim_p; + char *colon_p, *ip_addr = NULL; + int ip_len, ret; + + /* + * The end of the hostname occurs immediately preceding the delimiter or + * the port marker (':') where the delimiter takes precedence. + */ + delim_p = memchr(name, delim, namelen); + colon_p = memchr(name, ':', namelen); + + if (delim_p && colon_p) + end = delim_p < colon_p ? delim_p : colon_p; + else if (!delim_p && colon_p) + end = colon_p; + else { + end = delim_p; + if (!end) /* case: hostname:/ */ + end = name + namelen; + } + + if (end <= name) + return -EINVAL; + + /* do dns_resolve upcall */ + ip_len = dns_query(NULL, name, end - name, NULL, &ip_addr, NULL); + if (ip_len > 0) + ret = ceph_pton(ip_addr, ip_len, ss, -1, NULL); + else + ret = -ESRCH; + + kfree(ip_addr); + + *ipend = end; + + pr_info("resolve '%.*s' (ret=%d): %s\n", (int)(end - name), name, + ret, ret ? "failed" : ceph_pr_addr(ss)); + + return ret; +} +#else +static inline int ceph_dns_resolve_name(const char *name, size_t namelen, + struct sockaddr_storage *ss, char delim, const char **ipend) +{ + return -EINVAL; +} +#endif + +/* + * Parse a server name (IP or hostname). If a valid IP address is not found + * then try to extract a hostname to resolve using userspace DNS upcall. + */ +static int ceph_parse_server_name(const char *name, size_t namelen, + struct sockaddr_storage *ss, char delim, const char **ipend) +{ + int ret; + + ret = ceph_pton(name, namelen, ss, delim, ipend); + if (ret) + ret = ceph_dns_resolve_name(name, namelen, ss, delim, ipend); + + return ret; +} + /* * Parse an ip[:port] list into an addr array. Use the default * monitor port if a port isn't specified. @@ -1085,15 +1181,13 @@ int ceph_parse_ips(const char *c, const char *end, struct ceph_entity_addr *addr, int max_count, int *count) { - int i; + int i, ret = -EINVAL; const char *p = c; dout("parse_ips on '%.*s'\n", (int)(end-c), c); for (i = 0; i < max_count; i++) { const char *ipend; struct sockaddr_storage *ss = &addr[i].in_addr; - struct sockaddr_in *in4 = (void *)ss; - struct sockaddr_in6 *in6 = (void *)ss; int port; char delim = ','; @@ -1102,15 +1196,11 @@ int ceph_parse_ips(const char *c, const char *end, p++; } - memset(ss, 0, sizeof(*ss)); - if (in4_pton(p, end - p, (u8 *)&in4->sin_addr.s_addr, - delim, &ipend)) - ss->ss_family = AF_INET; - else if (in6_pton(p, end - p, (u8 *)&in6->sin6_addr.s6_addr, - delim, &ipend)) - ss->ss_family = AF_INET6; - else + ret = ceph_parse_server_name(p, end - p, ss, delim, &ipend); + if (ret) goto bad; + ret = -EINVAL; + p = ipend; if (delim == ']') { @@ -1155,7 +1245,7 @@ int ceph_parse_ips(const char *c, const char *end, bad: pr_err("parse_ips bad ip '%.*s'\n", (int)(end - c), c); - return -EINVAL; + return ret; } EXPORT_SYMBOL(ceph_parse_ips); -- cgit v1.2.3 From 38d6453ca39ecce442628a93e1bb46d70d547512 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 14 Oct 2011 13:33:55 -0700 Subject: libceph: force resend of osd requests if we skip an osdmap If we skip over one or more map epochs, we need to resend all osd requests because it is possible they remapped to other servers and then back. Signed-off-by: Sage Weil --- net/ceph/osd_client.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'net') diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 01ceb59a8b4a..733e46008b89 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -943,7 +943,7 @@ EXPORT_SYMBOL(ceph_osdc_set_request_linger); * Caller should hold map_sem for read and request_mutex. */ static int __map_request(struct ceph_osd_client *osdc, - struct ceph_osd_request *req) + struct ceph_osd_request *req, int force_resend) { struct ceph_osd_request_head *reqhead = req->r_request->front.iov_base; struct ceph_pg pgid; @@ -967,7 +967,8 @@ static int __map_request(struct ceph_osd_client *osdc, num = err; } - if ((req->r_osd && req->r_osd->o_osd == o && + if ((!force_resend && + req->r_osd && req->r_osd->o_osd == o && req->r_sent >= req->r_osd->o_incarnation && req->r_num_pg_osds == num && memcmp(req->r_pg_osds, acting, sizeof(acting[0])*num) == 0) || @@ -1289,18 +1290,18 @@ static void reset_changed_osds(struct ceph_osd_client *osdc) * * Caller should hold map_sem for read and request_mutex. */ -static void kick_requests(struct ceph_osd_client *osdc) +static void kick_requests(struct ceph_osd_client *osdc, int force_resend) { struct ceph_osd_request *req, *nreq; struct rb_node *p; int needmap = 0; int err; - dout("kick_requests\n"); + dout("kick_requests %s\n", force_resend ? " (force resend)" : ""); mutex_lock(&osdc->request_mutex); for (p = rb_first(&osdc->requests); p; p = rb_next(p)) { req = rb_entry(p, struct ceph_osd_request, r_node); - err = __map_request(osdc, req); + err = __map_request(osdc, req, force_resend); if (err < 0) continue; /* error */ if (req->r_osd == NULL) { @@ -1318,7 +1319,7 @@ static void kick_requests(struct ceph_osd_client *osdc) r_linger_item) { dout("linger req=%p req->r_osd=%p\n", req, req->r_osd); - err = __map_request(osdc, req); + err = __map_request(osdc, req, force_resend); if (err == 0) continue; /* no change and no osd was specified */ if (err < 0) @@ -1395,7 +1396,7 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg) ceph_osdmap_destroy(osdc->osdmap); osdc->osdmap = newmap; } - kick_requests(osdc); + kick_requests(osdc, 0); reset_changed_osds(osdc); } else { dout("ignoring incremental map %u len %d\n", @@ -1423,6 +1424,8 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg) "older than our %u\n", epoch, maplen, osdc->osdmap->epoch); } else { + int skipped_map = 0; + dout("taking full map %u len %d\n", epoch, maplen); newmap = osdmap_decode(&p, p+maplen); if (IS_ERR(newmap)) { @@ -1432,9 +1435,12 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg) BUG_ON(!newmap); oldmap = osdc->osdmap; osdc->osdmap = newmap; - if (oldmap) + if (oldmap) { + if (oldmap->epoch + 1 < newmap->epoch) + skipped_map = 1; ceph_osdmap_destroy(oldmap); - kick_requests(osdc); + } + kick_requests(osdc, skipped_map); } p += maplen; nr_maps--; @@ -1707,7 +1713,7 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, * the request still han't been touched yet. */ if (req->r_sent == 0) { - rc = __map_request(osdc, req); + rc = __map_request(osdc, req, 0); if (rc < 0) { if (nofail) { dout("osdc_start_request failed map, " -- cgit v1.2.3 From 3a9a231d977222eea36eae091df2c358e03ac839 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Fri, 27 May 2011 09:12:25 -0400 Subject: net: Fix files explicitly needing to include module.h With calls to modular infrastructure, these files really needs the full module.h header. Call it out so some of the cleanups of implicit and unrequired includes elsewhere can be cleaned up. Signed-off-by: Paul Gortmaker --- net/802/garp.c | 1 + net/802/stp.c | 1 + net/8021q/vlan_netlink.c | 1 + net/bluetooth/hci_sysfs.c | 1 + net/bluetooth/mgmt.c | 1 + net/caif/caif_dev.c | 1 + net/core/fib_rules.c | 1 + net/dcb/dcbnl.c | 1 + net/dsa/dsa.c | 1 + net/ipv4/inet_timewait_sock.c | 1 + net/ipv4/netfilter/nf_nat_proto_sctp.c | 1 + net/ipv4/netfilter/nf_nat_proto_udplite.c | 1 + net/mac80211/rate.c | 1 + net/netfilter/x_tables.c | 1 + net/netfilter/xt_quota.c | 1 + net/netfilter/xt_statistic.c | 1 + net/nfc/af_nfc.c | 1 + net/phonet/pep.c | 1 + net/rds/ib.c | 1 + net/rds/iw.c | 1 + net/rds/rdma_transport.c | 1 + net/rds/tcp.c | 1 + net/sched/act_api.c | 1 + net/sched/cls_flow.c | 1 + net/sched/sch_mqprio.c | 1 + net/sunrpc/svc_xprt.c | 1 + net/sunrpc/svcsock.c | 1 + net/tipc/core.c | 2 ++ net/wimax/stack.c | 1 + 29 files changed, 30 insertions(+) (limited to 'net') diff --git a/net/802/garp.c b/net/802/garp.c index 070bf4403bf8..8e21b6db3981 100644 --- a/net/802/garp.c +++ b/net/802/garp.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/net/802/stp.c b/net/802/stp.c index 0e136ef1e4ba..15540b7323cd 100644 --- a/net/802/stp.c +++ b/net/802/stp.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c index be9a5c19a775..235c2197dbb6 100644 --- a/net/8021q/vlan_netlink.c +++ b/net/8021q/vlan_netlink.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 22f1a6c87035..661b461cf0b0 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 5a94eec06caa..940858a48cbd 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -23,6 +23,7 @@ /* Bluetooth HCI Management interface */ #include +#include #include #include diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c index 47fc8f3a47cf..f1fa1f6e658d 100644 --- a/net/caif/caif_dev.c +++ b/net/caif/caif_dev.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 57e8f95110e6..c02e63c908da 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index 9bfbc1d1b50c..d86053002c16 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -25,6 +25,7 @@ #include #include #include +#include #include /** diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 3fb14b7c13cf..0dc1589343c3 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "dsa_priv.h" diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 44d65d546e30..89168c6351ff 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include diff --git a/net/ipv4/netfilter/nf_nat_proto_sctp.c b/net/ipv4/netfilter/nf_nat_proto_sctp.c index 756331d42661..bd5a80a62a5b 100644 --- a/net/ipv4/netfilter/nf_nat_proto_sctp.c +++ b/net/ipv4/netfilter/nf_nat_proto_sctp.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include diff --git a/net/ipv4/netfilter/nf_nat_proto_udplite.c b/net/ipv4/netfilter/nf_nat_proto_udplite.c index 3cc8c8af39ef..f83ef23e2ab7 100644 --- a/net/ipv4/netfilter/nf_nat_proto_udplite.c +++ b/net/ipv4/netfilter/nf_nat_proto_udplite.c @@ -13,6 +13,7 @@ #include #include +#include #include #include diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index ff5c3aa48a15..5a5a7767d541 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "rate.h" #include "ieee80211_i.h" #include "debugfs.h" diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index 71441b934ffd..8d987c3573fd 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -14,6 +14,7 @@ */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include diff --git a/net/netfilter/xt_quota.c b/net/netfilter/xt_quota.c index 70eb2b4984dd..44c8eb4c9d66 100644 --- a/net/netfilter/xt_quota.c +++ b/net/netfilter/xt_quota.c @@ -9,6 +9,7 @@ #include #include +#include struct xt_quota_priv { spinlock_t lock; diff --git a/net/netfilter/xt_statistic.c b/net/netfilter/xt_statistic.c index 42ecb71d445f..4fe4fb4276d0 100644 --- a/net/netfilter/xt_statistic.c +++ b/net/netfilter/xt_statistic.c @@ -16,6 +16,7 @@ #include #include +#include struct xt_statistic_priv { atomic_t count; diff --git a/net/nfc/af_nfc.c b/net/nfc/af_nfc.c index e982cef8f49d..da67756425ce 100644 --- a/net/nfc/af_nfc.c +++ b/net/nfc/af_nfc.c @@ -22,6 +22,7 @@ */ #include +#include #include "nfc.h" diff --git a/net/phonet/pep.c b/net/phonet/pep.c index f17fd841f948..2ba6e9fb4cbc 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include diff --git a/net/rds/ib.c b/net/rds/ib.c index 3b83086bcc30..b4c8b0022fee 100644 --- a/net/rds/ib.c +++ b/net/rds/ib.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "rds.h" #include "ib.h" diff --git a/net/rds/iw.c b/net/rds/iw.c index f7474844f096..7826d46baa70 100644 --- a/net/rds/iw.c +++ b/net/rds/iw.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "rds.h" #include "iw.h" diff --git a/net/rds/rdma_transport.c b/net/rds/rdma_transport.c index f8760e1b6688..c2be901d19ee 100644 --- a/net/rds/rdma_transport.c +++ b/net/rds/rdma_transport.c @@ -30,6 +30,7 @@ * SOFTWARE. * */ +#include #include #include "rdma_transport.h" diff --git a/net/rds/tcp.c b/net/rds/tcp.c index 8e0a32001c90..edac9ef2bc8b 100644 --- a/net/rds/tcp.c +++ b/net/rds/tcp.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include "rds.h" diff --git a/net/sched/act_api.c b/net/sched/act_api.c index f2fb67e701a3..93fdf131bd75 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c index 9e087d885675..7b582300d051 100644 --- a/net/sched/cls_flow.c +++ b/net/sched/cls_flow.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/net/sched/sch_mqprio.c b/net/sched/sch_mqprio.c index ea17cbed29ef..f88256cbacbf 100644 --- a/net/sched/sch_mqprio.c +++ b/net/sched/sch_mqprio.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index d86bb673e1f6..447cd0eb415c 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c @@ -14,6 +14,7 @@ #include #include #include +#include #define RPCDBG_FACILITY RPCDBG_SVCXPRT diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index dfd686eb0b7f..71bed1c1c77a 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/net/tipc/core.c b/net/tipc/core.c index 943b6af84265..c21331d58fdb 100644 --- a/net/tipc/core.c +++ b/net/tipc/core.c @@ -34,6 +34,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include + #include "core.h" #include "ref.h" #include "name_table.h" diff --git a/net/wimax/stack.c b/net/wimax/stack.c index ee99e7dfcdba..3c65eae701c4 100644 --- a/net/wimax/stack.c +++ b/net/wimax/stack.c @@ -55,6 +55,7 @@ #include #include #include +#include #include "wimax-internal.h" -- cgit v1.2.3 From d9b9384215e17c68d7b6bd05d6fa409e5d4140d7 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 18 Sep 2011 13:21:27 -0400 Subject: net: add moduleparam.h for users of module_param/MODULE_PARM_DESC These files were getting access to these two via the implicit presence of module.h everywhere. They aren't modules, so they don't need the full module.h inclusion though. Signed-off-by: Paul Gortmaker --- net/dccp/ccids/lib/tfrc.c | 1 + net/mac80211/mlme.c | 1 + net/netfilter/nf_conntrack_expect.c | 1 + net/rds/send.c | 1 + net/rfkill/input.c | 1 + net/wireless/reg.c | 1 + 6 files changed, 6 insertions(+) (limited to 'net') diff --git a/net/dccp/ccids/lib/tfrc.c b/net/dccp/ccids/lib/tfrc.c index 4902029854d8..1f94b7e01d39 100644 --- a/net/dccp/ccids/lib/tfrc.c +++ b/net/dccp/ccids/lib/tfrc.c @@ -4,6 +4,7 @@ * Copyright (c) 2007 The University of Aberdeen, Scotland, UK * Copyright (c) 2007 Arnaldo Carvalho de Melo */ +#include #include "tfrc.h" #ifdef CONFIG_IP_DCCP_TFRC_DEBUG diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index ba2da11a997b..72f1e806a8ca 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index cd1e8e0970f2..aaaac4461720 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include diff --git a/net/rds/send.c b/net/rds/send.c index aa57e22539ef..30a80ea6fcab 100644 --- a/net/rds/send.c +++ b/net/rds/send.c @@ -31,6 +31,7 @@ * */ #include +#include #include #include #include diff --git a/net/rfkill/input.c b/net/rfkill/input.c index 1bca6d49ec96..24c55c53e6a2 100644 --- a/net/rfkill/input.c +++ b/net/rfkill/input.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 2520a1b7e7db..c23052bca16b 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include "core.h" #include "reg.h" -- cgit v1.2.3 From bc3b2d7fb9b014d75ebb79ba371a763dbab5e8cf Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Fri, 15 Jul 2011 11:47:34 -0400 Subject: net: Add export.h for EXPORT_SYMBOL/THIS_MODULE to non-modules These files are non modular, but need to export symbols using the macros now living in export.h -- call out the include so that things won't break when we remove the implicit presence of module.h from everywhere. Signed-off-by: Paul Gortmaker --- net/802/fc.c | 1 + net/8021q/vlan_core.c | 1 + net/appletalk/aarp.c | 1 + net/appletalk/atalk_proc.c | 1 + net/atm/pvc.c | 1 + net/atm/svc.c | 1 + net/ax25/ax25_route.c | 1 + net/ax25/ax25_uid.c | 1 + net/bluetooth/l2cap_sock.c | 1 + net/bridge/br_input.c | 1 + net/caif/cfpkt_skbuff.c | 1 + net/ceph/messenger.c | 1 + net/compat.c | 1 + net/core/dev_addr_lists.c | 1 + net/core/net-sysfs.c | 1 + net/core/net-traces.c | 1 + net/core/net_namespace.c | 1 + net/core/netevent.c | 1 + net/core/netpoll.c | 1 + net/core/timestamping.c | 1 + net/core/user_dma.c | 1 + net/dcb/dcbevent.c | 1 + net/dccp/ackvec.c | 1 + net/dccp/timer.c | 1 + net/decnet/dn_route.c | 1 + net/decnet/dn_rules.c | 1 + net/ieee802154/nl-mac.c | 1 + net/ipv4/fib_rules.c | 1 + net/ipv4/fib_trie.c | 1 + net/ipv4/ipconfig.c | 1 + net/ipv4/ipmr.c | 1 + net/ipv4/netfilter.c | 1 + net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 1 + net/ipv4/netfilter/nf_nat_proto_common.c | 1 + net/ipv4/netfilter/nf_nat_proto_icmp.c | 1 + net/ipv4/netfilter/nf_nat_proto_tcp.c | 1 + net/ipv4/netfilter/nf_nat_proto_udp.c | 1 + net/ipv4/ping.c | 1 + net/ipv4/proc.c | 1 + net/ipv4/raw.c | 1 + net/ipv4/syncookies.c | 1 + net/ipv4/udplite.c | 1 + net/ipv4/xfrm4_state.c | 1 + net/ipv6/addrconf.c | 1 + net/ipv6/addrconf_core.c | 1 + net/ipv6/exthdrs.c | 1 + net/ipv6/exthdrs_core.c | 1 + net/ipv6/fib6_rules.c | 1 + net/ipv6/ip6_flowlabel.c | 1 + net/ipv6/ip6mr.c | 1 + net/ipv6/netfilter.c | 1 + net/ipv6/proc.c | 1 + net/ipv6/raw.c | 1 + net/ipv6/reassembly.c | 1 + net/ipv6/route.c | 1 + net/ipv6/sysctl_net_ipv6.c | 1 + net/ipv6/udplite.c | 1 + net/ipv6/xfrm6_state.c | 1 + net/ipx/ipx_proc.c | 1 + net/irda/discovery.c | 1 + net/irda/irda_device.c | 1 + net/irda/irttp.c | 1 + net/irda/qos.c | 2 ++ net/llc/llc_input.c | 1 + net/llc/llc_output.c | 1 + net/llc/llc_proc.c | 1 + net/mac80211/agg-rx.c | 1 + net/mac80211/agg-tx.c | 1 + net/mac80211/ht.c | 1 + net/mac80211/key.c | 1 + net/mac80211/led.c | 1 + net/mac80211/mlme.c | 1 + net/mac80211/offchannel.c | 1 + net/mac80211/rc80211_minstrel_debugfs.c | 1 + net/mac80211/rc80211_minstrel_ht_debugfs.c | 1 + net/mac80211/rc80211_pid_debugfs.c | 1 + net/mac80211/rx.c | 1 + net/mac80211/scan.c | 1 + net/mac80211/status.c | 1 + net/mac80211/tkip.c | 1 + net/mac80211/tx.c | 1 + net/mac80211/util.c | 1 + net/netfilter/ipset/ip_set_getport.c | 1 + net/netfilter/ipset/pfxlen.c | 1 + net/netfilter/nf_conntrack_acct.c | 1 + net/netfilter/nf_conntrack_ecache.c | 1 + net/netfilter/nf_conntrack_expect.c | 1 + net/netrom/nr_route.c | 1 + net/nfc/nci/core.c | 1 + net/nfc/rawsock.c | 1 + net/phonet/datagram.c | 1 + net/phonet/socket.c | 1 + net/rds/cong.c | 1 + net/rds/connection.c | 1 + net/rds/info.c | 1 + net/rds/message.c | 1 + net/rds/page.c | 1 + net/rds/recv.c | 1 + net/rds/send.c | 1 + net/rds/stats.c | 1 + net/rds/threads.c | 1 + net/rose/rose_route.c | 1 + net/rxrpc/ar-output.c | 1 + net/rxrpc/ar-recvmsg.c | 1 + net/sched/sch_mq.c | 1 + net/sctp/proc.c | 1 + net/sctp/socket.c | 1 + net/sunrpc/addr.c | 1 + net/sunrpc/backchannel_rqst.c | 1 + net/sunrpc/socklib.c | 1 + net/sunrpc/xprtrdma/svc_rdma_transport.c | 1 + net/sysctl_net.c | 1 + net/tipc/socket.c | 1 + net/wimax/op-msg.c | 1 + net/wimax/op-reset.c | 1 + net/wimax/op-rfkill.c | 1 + net/wireless/ibss.c | 1 + net/wireless/mesh.c | 1 + net/wireless/radiotap.c | 1 + net/wireless/reg.c | 1 + net/wireless/sme.c | 1 + net/wireless/util.c | 1 + net/wireless/wext-compat.c | 1 + net/wireless/wext-core.c | 1 + net/wireless/wext-sme.c | 1 + net/wireless/wext-spy.c | 1 + net/x25/x25_proc.c | 1 + net/xfrm/xfrm_proc.c | 1 + net/xfrm/xfrm_replay.c | 1 + 129 files changed, 130 insertions(+) (limited to 'net') diff --git a/net/802/fc.c b/net/802/fc.c index 1e49f2d4ea96..bd345f3d29f8 100644 --- a/net/802/fc.c +++ b/net/802/fc.c @@ -27,6 +27,7 @@ #include #include #include +#include #include /* diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index f1f2f7bb6661..1f64cc9da1b0 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "vlan.h" bool vlan_do_receive(struct sk_buff **skbp) diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c index 1acc69576df8..173a2e82f486 100644 --- a/net/appletalk/aarp.c +++ b/net/appletalk/aarp.c @@ -39,6 +39,7 @@ #include #include #include +#include int sysctl_aarp_expiry_time = AARP_EXPIRY_TIME; int sysctl_aarp_tick_time = AARP_TICK_TIME; diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c index 6ef0e761e5de..b5b1a221c242 100644 --- a/net/appletalk/atalk_proc.c +++ b/net/appletalk/atalk_proc.c @@ -14,6 +14,7 @@ #include #include #include +#include static __inline__ struct atalk_iface *atalk_get_interface_idx(loff_t pos) diff --git a/net/atm/pvc.c b/net/atm/pvc.c index 437ee70c5e62..3a734919c36c 100644 --- a/net/atm/pvc.c +++ b/net/atm/pvc.c @@ -11,6 +11,7 @@ #include #include #include