]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Merge tag 'ceph-for-5.1-rc2' of git://github.com/ceph/ceph-client
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 23 Mar 2019 17:04:47 +0000 (10:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 23 Mar 2019 17:04:47 +0000 (10:04 -0700)
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

drivers/block/rbd.c
include/linux/ceph/libceph.h
net/ceph/ceph_common.c
net/ceph/mon_client.c

index 4ba967d65cf963c6f2a2084a62f2dbad1935c3bf..2210c1b9491ba2e9f690dd4a26b209b64f4ad925 100644 (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);
        }
index a420c07904bcd7f6e7a082ebe0e78d913f94674e..337d5049ff93b5849b925086f33d509f29da5efa 100644 (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);
index 9cab80207ced6346b5b5b97b56e98674f28def73..79eac465ec65e99cf22e475f3edb0609ea4787e5 100644 (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)
 {
index 18deb3d889c4ae94a10417457fa0275a77568b48..a53e4fbb631918ccf94536849e5e25acad2dfdc6 100644 (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;