diff options
-rw-r--r-- | include/linux/ceph/libceph.h | 2 | ||||
-rw-r--r-- | net/ceph/ceph_common.c | 18 | ||||
-rw-r--r-- | net/ceph/mon_client.c | 9 |
3 files changed, 28 insertions, 1 deletions
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index a420c07904bc..337d5049ff93 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h | |||
@@ -294,6 +294,8 @@ extern void ceph_destroy_client(struct ceph_client *client); | |||
294 | extern int __ceph_open_session(struct ceph_client *client, | 294 | extern int __ceph_open_session(struct ceph_client *client, |
295 | unsigned long started); | 295 | unsigned long started); |
296 | extern int ceph_open_session(struct ceph_client *client); | 296 | extern int ceph_open_session(struct ceph_client *client); |
297 | int ceph_wait_for_latest_osdmap(struct ceph_client *client, | ||
298 | unsigned long timeout); | ||
297 | 299 | ||
298 | /* pagevec.c */ | 300 | /* pagevec.c */ |
299 | extern void ceph_release_page_vector(struct page **pages, int num_pages); | 301 | extern void ceph_release_page_vector(struct page **pages, int num_pages); |
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 9cab80207ced..79eac465ec65 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c | |||
@@ -738,7 +738,6 @@ int __ceph_open_session(struct ceph_client *client, unsigned long started) | |||
738 | } | 738 | } |
739 | EXPORT_SYMBOL(__ceph_open_session); | 739 | EXPORT_SYMBOL(__ceph_open_session); |
740 | 740 | ||
741 | |||
742 | int ceph_open_session(struct ceph_client *client) | 741 | int ceph_open_session(struct ceph_client *client) |
743 | { | 742 | { |
744 | int ret; | 743 | int ret; |
@@ -754,6 +753,23 @@ int ceph_open_session(struct ceph_client *client) | |||
754 | } | 753 | } |
755 | EXPORT_SYMBOL(ceph_open_session); | 754 | EXPORT_SYMBOL(ceph_open_session); |
756 | 755 | ||
756 | int ceph_wait_for_latest_osdmap(struct ceph_client *client, | ||
757 | unsigned long timeout) | ||
758 | { | ||
759 | u64 newest_epoch; | ||
760 | int ret; | ||
761 | |||
762 | ret = ceph_monc_get_version(&client->monc, "osdmap", &newest_epoch); | ||
763 | if (ret) | ||
764 | return ret; | ||
765 | |||
766 | if (client->osdc.osdmap->epoch >= newest_epoch) | ||
767 | return 0; | ||
768 | |||
769 | ceph_osdc_maybe_request_map(&client->osdc); | ||
770 | return ceph_monc_wait_osdmap(&client->monc, newest_epoch, timeout); | ||
771 | } | ||
772 | EXPORT_SYMBOL(ceph_wait_for_latest_osdmap); | ||
757 | 773 | ||
758 | static int __init init_ceph_lib(void) | 774 | static int __init init_ceph_lib(void) |
759 | { | 775 | { |
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index 18deb3d889c4..a53e4fbb6319 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c | |||
@@ -922,6 +922,15 @@ int ceph_monc_blacklist_add(struct ceph_mon_client *monc, | |||
922 | mutex_unlock(&monc->mutex); | 922 | mutex_unlock(&monc->mutex); |
923 | 923 | ||
924 | ret = wait_generic_request(req); | 924 | ret = wait_generic_request(req); |
925 | if (!ret) | ||
926 | /* | ||
927 | * Make sure we have the osdmap that includes the blacklist | ||
928 | * entry. This is needed to ensure that the OSDs pick up the | ||
929 | * new blacklist before processing any future requests from | ||
930 | * this client. | ||
931 | */ | ||
932 | ret = ceph_wait_for_latest_osdmap(monc->client, 0); | ||
933 | |||
925 | out: | 934 | out: |
926 | put_generic_request(req); | 935 | put_generic_request(req); |
927 | return ret; | 936 | return ret; |