Skip to content

Commit 9a1050a

Browse files
committed
Merge tag 'ceph-for-5.1-rc2' of git://github.com/ceph/ceph-client
Pull ceph fixes from Ilya Dryomov: "A follow up for the new alloc_size logic and a blacklisting fix, marked for stable" * tag 'ceph-for-5.1-rc2' of git://github.com/ceph/ceph-client: rbd: drop wait_for_latest_osdmap() libceph: wait for latest osdmap in ceph_monc_blacklist_add() rbd: set io_min, io_opt and discard_granularity to alloc_size
2 parents a5ed1e9 + 9d4a227 commit 9a1050a

File tree

4 files changed

+34
-23
lines changed

4 files changed

+34
-23
lines changed

drivers/block/rbd.c

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ static int parse_rbd_opts_token(char *c, void *private)
833833
pctx->opts->queue_depth = intval;
834834
break;
835835
case Opt_alloc_size:
836-
if (intval < 1) {
836+
if (intval < SECTOR_SIZE) {
837837
pr_err("alloc_size out of range\n");
838838
return -EINVAL;
839839
}
@@ -924,23 +924,6 @@ static void rbd_put_client(struct rbd_client *rbdc)
924924
kref_put(&rbdc->kref, rbd_client_release);
925925
}
926926

927-
static int wait_for_latest_osdmap(struct ceph_client *client)
928-
{
929-
u64 newest_epoch;
930-
int ret;
931-
932-
ret = ceph_monc_get_version(&client->monc, "osdmap", &newest_epoch);
933-
if (ret)
934-
return ret;
935-
936-
if (client->osdc.osdmap->epoch >= newest_epoch)
937-
return 0;
938-
939-
ceph_osdc_maybe_request_map(&client->osdc);
940-
return ceph_monc_wait_osdmap(&client->monc, newest_epoch,
941-
client->options->mount_timeout);
942-
}
943-
944927
/*
945928
* Get a ceph client with specific addr and configuration, if one does
946929
* not exist create it. Either way, ceph_opts is consumed by this
@@ -960,7 +943,8 @@ static struct rbd_client *rbd_get_client(struct ceph_options *ceph_opts)
960943
* Using an existing client. Make sure ->pg_pools is up to
961944
* date before we look up the pool id in do_rbd_add().
962945
*/
963-
ret = wait_for_latest_osdmap(rbdc->client);
946+
ret = ceph_wait_for_latest_osdmap(rbdc->client,
947+
rbdc->client->options->mount_timeout);
964948
if (ret) {
965949
rbd_warn(NULL, "failed to get latest osdmap: %d", ret);
966950
rbd_put_client(rbdc);
@@ -4203,12 +4187,12 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
42034187
q->limits.max_sectors = queue_max_hw_sectors(q);
42044188
blk_queue_max_segments(q, USHRT_MAX);
42054189
blk_queue_max_segment_size(q, UINT_MAX);
4206-
blk_queue_io_min(q, objset_bytes);
4207-
blk_queue_io_opt(q, objset_bytes);
4190+
blk_queue_io_min(q, rbd_dev->opts->alloc_size);
4191+
blk_queue_io_opt(q, rbd_dev->opts->alloc_size);
42084192

42094193
if (rbd_dev->opts->trim) {
42104194
blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
4211-
q->limits.discard_granularity = objset_bytes;
4195+
q->limits.discard_granularity = rbd_dev->opts->alloc_size;
42124196
blk_queue_max_discard_sectors(q, objset_bytes >> SECTOR_SHIFT);
42134197
blk_queue_max_write_zeroes_sectors(q, objset_bytes >> SECTOR_SHIFT);
42144198
}

include/linux/ceph/libceph.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ extern void ceph_destroy_client(struct ceph_client *client);
294294
extern int __ceph_open_session(struct ceph_client *client,
295295
unsigned long started);
296296
extern int ceph_open_session(struct ceph_client *client);
297+
int ceph_wait_for_latest_osdmap(struct ceph_client *client,
298+
unsigned long timeout);
297299

298300
/* pagevec.c */
299301
extern void ceph_release_page_vector(struct page **pages, int num_pages);

net/ceph/ceph_common.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,6 @@ int __ceph_open_session(struct ceph_client *client, unsigned long started)
738738
}
739739
EXPORT_SYMBOL(__ceph_open_session);
740740

741-
742741
int ceph_open_session(struct ceph_client *client)
743742
{
744743
int ret;
@@ -754,6 +753,23 @@ int ceph_open_session(struct ceph_client *client)
754753
}
755754
EXPORT_SYMBOL(ceph_open_session);
756755

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);
757773

758774
static int __init init_ceph_lib(void)
759775
{

net/ceph/mon_client.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,15 @@ int ceph_monc_blacklist_add(struct ceph_mon_client *monc,
922922
mutex_unlock(&monc->mutex);
923923

924924
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+
925934
out:
926935
put_generic_request(req);
927936
return ret;

0 commit comments

Comments
 (0)