A follow up for the new alloc_size logic and a blacklisting fix, marked

for stable.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCAAxFiEEydHwtzie9C7TfviiSn/eOAIR84sFAlyVCYsTHGlkcnlvbW92
 QGdtYWlsLmNvbQAKCRBKf944AhHzi6oFB/9Lw2OMiNrdMAgfOzcVkB4dbXbRtryG
 rBsTUc/fwFrCl2N+wRmJKUkDP1e1phM9CHaGEoBYB+vL2Hhj8kjyJN4NY1g09ilt
 w8XT6Pkg2Uui4kr5bnWzDS+oO8hm1ES2PbzDnIX1UiLStHypzQFwzvlm+TQE8jxb
 pGNyNnbASJ+2mk+xAz7EkLGlNcAgULUT7oC/w0xj0neM739aYS3IsZgWylnw41CS
 59TDyWROUUePLQnvieXmp4l58fn7xpvwrUE0KQgYec+j2t2SsKnHUoI86qZFYF2Q
 NsE/K2fmIvKxWrmNw+0uuOVj+mNr2Jr5m/q+Nu61asOjs7Hz5CwUp7nd
 =DkXC
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2019-03-23 10:04:47 -07:00
commit 9a1050ad83
4 changed files with 34 additions and 23 deletions

View file

@ -833,7 +833,7 @@ static int parse_rbd_opts_token(char *c, void *private)
pctx->opts->queue_depth = intval;
break;
case Opt_alloc_size:
if (intval < 1) {
if (intval < SECTOR_SIZE) {
pr_err("alloc_size out of range\n");
return -EINVAL;
}
@ -924,23 +924,6 @@ static void rbd_put_client(struct rbd_client *rbdc)
kref_put(&rbdc->kref, rbd_client_release);
}
static int wait_for_latest_osdmap(struct ceph_client *client)
{
u64 newest_epoch;
int ret;
ret = ceph_monc_get_version(&client->monc, "osdmap", &newest_epoch);
if (ret)
return ret;
if (client->osdc.osdmap->epoch >= newest_epoch)
return 0;
ceph_osdc_maybe_request_map(&client->osdc);
return ceph_monc_wait_osdmap(&client->monc, newest_epoch,
client->options->mount_timeout);
}
/*
* Get a ceph client with specific addr and configuration, if one does
* 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)
* Using an existing client. Make sure ->pg_pools is up to
* date before we look up the pool id in do_rbd_add().
*/
ret = wait_for_latest_osdmap(rbdc->client);
ret = ceph_wait_for_latest_osdmap(rbdc->client,
rbdc->client->options->mount_timeout);
if (ret) {
rbd_warn(NULL, "failed to get latest osdmap: %d", ret);
rbd_put_client(rbdc);
@ -4203,12 +4187,12 @@ static int rbd_init_disk(struct rbd_device *rbd_dev)
q->limits.max_sectors = queue_max_hw_sectors(q);
blk_queue_max_segments(q, USHRT_MAX);
blk_queue_max_segment_size(q, UINT_MAX);
blk_queue_io_min(q, objset_bytes);
blk_queue_io_opt(q, objset_bytes);
blk_queue_io_min(q, rbd_dev->opts->alloc_size);
blk_queue_io_opt(q, rbd_dev->opts->alloc_size);
if (rbd_dev->opts->trim) {
blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
q->limits.discard_granularity = objset_bytes;
q->limits.discard_granularity = rbd_dev->opts->alloc_size;
blk_queue_max_discard_sectors(q, objset_bytes >> SECTOR_SHIFT);
blk_queue_max_write_zeroes_sectors(q, objset_bytes >> SECTOR_SHIFT);
}

View file

@ -294,6 +294,8 @@ extern void ceph_destroy_client(struct ceph_client *client);
extern int __ceph_open_session(struct ceph_client *client,
unsigned long started);
extern int ceph_open_session(struct ceph_client *client);
int ceph_wait_for_latest_osdmap(struct ceph_client *client,
unsigned long timeout);
/* pagevec.c */
extern void ceph_release_page_vector(struct page **pages, int num_pages);

View file

@ -738,7 +738,6 @@ int __ceph_open_session(struct ceph_client *client, unsigned long started)
}
EXPORT_SYMBOL(__ceph_open_session);
int ceph_open_session(struct ceph_client *client)
{
int ret;
@ -754,6 +753,23 @@ int ceph_open_session(struct ceph_client *client)
}
EXPORT_SYMBOL(ceph_open_session);
int ceph_wait_for_latest_osdmap(struct ceph_client *client,
unsigned long timeout)
{
u64 newest_epoch;
int ret;
ret = ceph_monc_get_version(&client->monc, "osdmap", &newest_epoch);
if (ret)
return ret;
if (client->osdc.osdmap->epoch >= newest_epoch)
return 0;
ceph_osdc_maybe_request_map(&client->osdc);
return ceph_monc_wait_osdmap(&client->monc, newest_epoch, timeout);
}
EXPORT_SYMBOL(ceph_wait_for_latest_osdmap);
static int __init init_ceph_lib(void)
{

View file

@ -922,6 +922,15 @@ int ceph_monc_blacklist_add(struct ceph_mon_client *monc,
mutex_unlock(&monc->mutex);
ret = wait_generic_request(req);
if (!ret)
/*
* Make sure we have the osdmap that includes the blacklist
* entry. This is needed to ensure that the OSDs pick up the
* new blacklist before processing any future requests from
* this client.
*/
ret = ceph_wait_for_latest_osdmap(monc->client, 0);
out:
put_generic_request(req);
return ret;