Fix for dm-thin pool resizing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Expanding the data device consumes metadata space. Right now the data device is currently resized before the metadata device is. This creates a situation where you can reload the pool with a much larger metadata device and a larger data device, but it will fail the pool by running out of metadata space trying to expand the data device.

I've been able to fix this by simply changing around the order that things are checked. Rather than checking data device first, which might itself require too much metadata to expand, just check the metadata device first and expand that (allowing for the subsequent data device expansion).

static int pool_preresume(struct dm_target *ti)
{
    int r;
    bool need_commit;
    struct pool_c *pt = ti->private;
    struct pool *pool = pt->pool;

    /*
     * Take control of the pool object.
     */
    r = bind_control_target(pool, ti);
    if (r)
        return r;

    r = maybe_resize_metadata_dev(ti, &need_commit);
    if (r)
        return r;

    if(need_commit) (void) commit(pool);

    r = maybe_resize_data_dev(ti, &need_commit);
    if (r)
        return r;

    if(need_commit) (void) commit(pool);

    return 0;
}


Thanks for your hard work!
- Drew
--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux