Linux Device Mapper development
 help / color / mirror / Atom feed
From: Joe Thornber <thornber@redhat.com>
To: device-mapper development <dm-devel@redhat.com>
Subject: Re: dm-cache: clean cache resyncs to origin on every boot
Date: Thu, 22 Oct 2015 18:19:36 +0100	[thread overview]
Message-ID: <20151022171935.GA4296@rh-vpn> (raw)
In-Reply-To: <CAGRJ0wrPEo9m0kKeGy0U9BErKC=_GGUUgfgJn=NZm2cQpHnb3w@mail.gmail.com>

On Tue, Oct 20, 2015 at 11:06:07PM +0500, Bogdan Vasiliev wrote:
> Volume was clearly removed without dirty cahe blocks, re-initialized
> and began full re-sync to the origin. Is this normal behavior?

No, there is indeed a bug, fixed with the patch below.

Thanks,

- Joe


commit 7e0a9739fd9e72dc51490bdff92796400b12a34f
Author: Joe Thornber <ejt@redhat.com>
Date:   Thu Oct 22 18:10:55 2015 +0100

    [dm-cache] The CLEAN_SHUTDOWN flag was not being set
    
    or rather, it was being set on the disk, then immediately cleared again.
    
    If the CLEAN_SHUTDOWN flag is not set when a cache is loaded then all cache
    blocks are marked as dirty and a full writeback occurs.

diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
index e956c44..2073d30 100644
--- a/drivers/md/dm-cache-metadata.c
+++ b/drivers/md/dm-cache-metadata.c
@@ -634,10 +634,11 @@ static int __commit_transaction(struct dm_cache_metadata *cmd,
 
        disk_super = dm_block_data(sblock);
 
+       disk_super->flags = cpu_to_le32(cmd->flags);
+
        if (mutator)
                update_flags(disk_super, mutator);
 
-       disk_super->flags = cpu_to_le32(cmd->flags);
        disk_super->mapping_root = cpu_to_le64(cmd->root);
        disk_super->hint_root = cpu_to_le64(cmd->hint_root);
        disk_super->discard_root = cpu_to_le64(cmd->discard_root);

      reply	other threads:[~2015-10-22 17:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20  6:51 dm-cache: clean cache resyncs to origin on every boot Bogdan Vasiliev
2015-10-20 14:33 ` Joe Thornber
2015-10-20 18:00   ` sbp
2015-10-20 18:06   ` Bogdan Vasiliev
2015-10-22 17:19     ` Joe Thornber [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151022171935.GA4296@rh-vpn \
    --to=thornber@redhat.com \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox