2013-03-21 02:26:37

by Alasdair G Kergon

[permalink] [raw]
Subject: [git pull] device-mapper fixes for 3.9

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm tags/dm-3.9-fixes

to get the following device-mapper fixes for 3.9.

Thanks,
Alasdair

----------------------------------------------------------------
A set of device-mapper fixes for 3.9.

Fix reported data loss with discards and thin snapshots; avoid a
deadlock observed in dm verity; fix a race in the new dm cache code
along with some other minor bugs; store the cache policy version on disk
to make the stored hints format future-proof.

----------------------------------------------------------------
Heinz Mauelshagen (2):
dm cache: detect cache_create failure
dm cache: avoid calling policy destructor twice on error

Joe Thornber (5):
dm thin: fix discard corruption
dm thin: fix non power of two discard granularity calc
dm cache: avoid 64 bit division on 32 bit
dm cache: metadata clear dirty bits on clean shutdown
dm cache: fix race in writethrough implementation

Mike Snitzer (2):
dm cache: policy change version from string to integer set
dm cache: policy ignore hints if generated by different version

Mikulas Patocka (1):
dm verity: avoid deadlock

drivers/md/dm-bufio.c | 2 +
drivers/md/dm-cache-metadata.c | 64 ++++++++--
drivers/md/dm-cache-metadata.h | 2 +-
drivers/md/dm-cache-policy-cleaner.c | 7 +-
drivers/md/dm-cache-policy-internal.h | 2 +
drivers/md/dm-cache-policy-mq.c | 8 +-
drivers/md/dm-cache-policy.c | 8 ++
drivers/md/dm-cache-policy.h | 2 +
drivers/md/dm-cache-target.c | 169 +++++++++++++++++---------
drivers/md/dm-thin.c | 11 +-
drivers/md/dm-verity.c | 39 +++++-
drivers/md/persistent-data/dm-btree-remove.c | 46 +++----
12 files changed, 252 insertions(+), 108 deletions(-)


2013-03-22 18:53:41

by Darrick J. Wong

[permalink] [raw]
Subject: Re: [git pull] device-mapper fixes for 3.9

On Thu, Mar 21, 2013 at 02:26:26AM +0000, Alasdair G Kergon wrote:
> Please pull from:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm tags/dm-3.9-fixes
>
> to get the following device-mapper fixes for 3.9.
>
> Thanks,
> Alasdair
>
> ----------------------------------------------------------------
> A set of device-mapper fixes for 3.9.
>
> Fix reported data loss with discards and thin snapshots; avoid a
> deadlock observed in dm verity; fix a race in the new dm cache code
> along with some other minor bugs; store the cache policy version on disk
> to make the stored hints format future-proof.
>
> ----------------------------------------------------------------
> Heinz Mauelshagen (2):
> dm cache: detect cache_create failure
> dm cache: avoid calling policy destructor twice on error
>
> Joe Thornber (5):
> dm thin: fix discard corruption
> dm thin: fix non power of two discard granularity calc
> dm cache: avoid 64 bit division on 32 bit
> dm cache: metadata clear dirty bits on clean shutdown
> dm cache: fix race in writethrough implementation

I think I've found a bug in this new WT implementation. /dev/sdb is an SSD,
/dev/sda is a spinny disk, and both have been zeroed prior to running the
following:

# pvcreate /dev/sdb
# vgcreate -s 256K moocache /dev/sdb
# lvcreate -n metadata moocache -l 17
# lvcreate -n blocks moocache -l 2030
# echo '0 67108864 cache /dev/mapper/moocache-metadata /dev/mapper/moocache-blocks /dev/sda 512 1 writethrough default 4 random_threshold 4 sequential_threshold 32768' | dmsetup create moocache
# mkfs.ext4 /dev/mapper/moocache -U deadbeef-cafe-dead-beef-cafedeadbeef

If I then run blkid, I only see this:
/dev/sdb: UUID="jlKkqi-L3W1-QQqf-7HKR-jmjU-GL79-qDOdvP" TYPE="LVM2_member"
/dev/sda: UUID="deadbeef-cafe-dead-beef-cafedeadbeef" TYPE="ext4"

Curious -- it didn't find anything on /dev/mapper/moocache. e2fsck/mount also
see nothing, and dumping the first 256K shows zeroes. Sometimes it finds no
ext4 at all.

If I create the cache in WB mode, I see that blkid finds the deadbeef fs on
/dev/sda and /dev/mapper/moocache, like I'd expect:

/dev/sdb: UUID="9hYUEh-OOKT-KuqF-6eDy-2cEZ-2eEa-y17lhN" TYPE="LVM2_member"
/dev/mapper/moocache-blocks: UUID="deadbeef-cafe-dead-beef-cafedeadbeef" TYPE="ext4"
/dev/mapper/moocache: UUID="deadbeef-cafe-dead-beef-cafedeadbeef" TYPE="ext4"

--D

>
> Mike Snitzer (2):
> dm cache: policy change version from string to integer set
> dm cache: policy ignore hints if generated by different version
>
> Mikulas Patocka (1):
> dm verity: avoid deadlock
>
> drivers/md/dm-bufio.c | 2 +
> drivers/md/dm-cache-metadata.c | 64 ++++++++--
> drivers/md/dm-cache-metadata.h | 2 +-
> drivers/md/dm-cache-policy-cleaner.c | 7 +-
> drivers/md/dm-cache-policy-internal.h | 2 +
> drivers/md/dm-cache-policy-mq.c | 8 +-
> drivers/md/dm-cache-policy.c | 8 ++
> drivers/md/dm-cache-policy.h | 2 +
> drivers/md/dm-cache-target.c | 169 +++++++++++++++++---------
> drivers/md/dm-thin.c | 11 +-
> drivers/md/dm-verity.c | 39 +++++-
> drivers/md/persistent-data/dm-btree-remove.c | 46 +++----
> 12 files changed, 252 insertions(+), 108 deletions(-)
>

2013-03-22 20:14:43

by Darrick J. Wong

[permalink] [raw]
Subject: Re: [dm-devel] [git pull] device-mapper fixes for 3.9

On Fri, Mar 22, 2013 at 11:53:26AM -0700, Darrick J. Wong wrote:
> On Thu, Mar 21, 2013 at 02:26:26AM +0000, Alasdair G Kergon wrote:
> > Please pull from:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm tags/dm-3.9-fixes
> >
> > to get the following device-mapper fixes for 3.9.
> >
> > Thanks,
> > Alasdair
> >
> > ----------------------------------------------------------------
> > A set of device-mapper fixes for 3.9.
> >
> > Fix reported data loss with discards and thin snapshots; avoid a
> > deadlock observed in dm verity; fix a race in the new dm cache code
> > along with some other minor bugs; store the cache policy version on disk
> > to make the stored hints format future-proof.
> >
> > ----------------------------------------------------------------
> > Heinz Mauelshagen (2):
> > dm cache: detect cache_create failure
> > dm cache: avoid calling policy destructor twice on error
> >
> > Joe Thornber (5):
> > dm thin: fix discard corruption
> > dm thin: fix non power of two discard granularity calc
> > dm cache: avoid 64 bit division on 32 bit
> > dm cache: metadata clear dirty bits on clean shutdown
> > dm cache: fix race in writethrough implementation
>
> I think I've found a bug in this new WT implementation. /dev/sdb is an SSD,
> /dev/sda is a spinny disk, and both have been zeroed prior to running the
> following:
>
> # pvcreate /dev/sdb
> # vgcreate -s 256K moocache /dev/sdb
> # lvcreate -n metadata moocache -l 17
> # lvcreate -n blocks moocache -l 2030
> # echo '0 67108864 cache /dev/mapper/moocache-metadata /dev/mapper/moocache-blocks /dev/sda 512 1 writethrough default 4 random_threshold 4 sequential_threshold 32768' | dmsetup create moocache
> # mkfs.ext4 /dev/mapper/moocache -U deadbeef-cafe-dead-beef-cafedeadbeef
>
> If I then run blkid, I only see this:
> /dev/sdb: UUID="jlKkqi-L3W1-QQqf-7HKR-jmjU-GL79-qDOdvP" TYPE="LVM2_member"
> /dev/sda: UUID="deadbeef-cafe-dead-beef-cafedeadbeef" TYPE="ext4"
>
> Curious -- it didn't find anything on /dev/mapper/moocache. e2fsck/mount also
> see nothing, and dumping the first 256K shows zeroes. Sometimes it finds no
> ext4 at all.
>
> If I create the cache in WB mode, I see that blkid finds the deadbeef fs on
> /dev/sda and /dev/mapper/moocache, like I'd expect:
>
> /dev/sdb: UUID="9hYUEh-OOKT-KuqF-6eDy-2cEZ-2eEa-y17lhN" TYPE="LVM2_member"
> /dev/mapper/moocache-blocks: UUID="deadbeef-cafe-dead-beef-cafedeadbeef" TYPE="ext4"
> /dev/mapper/moocache: UUID="deadbeef-cafe-dead-beef-cafedeadbeef" TYPE="ext4"

It looks like dm-cache issues the bio first to the origin device with bi_sector
== N and bi_size == S, but then fails to reset these values when reissuing the
bio to the cache device. Therefore, the second issue of the bio goes out with
bi_size == 0 and bi_sector == N + (S >> 512), which is incorrect. I'll send a
patch.

--D
>
> --D
>
> >
> > Mike Snitzer (2):
> > dm cache: policy change version from string to integer set
> > dm cache: policy ignore hints if generated by different version
> >
> > Mikulas Patocka (1):
> > dm verity: avoid deadlock
> >
> > drivers/md/dm-bufio.c | 2 +
> > drivers/md/dm-cache-metadata.c | 64 ++++++++--
> > drivers/md/dm-cache-metadata.h | 2 +-
> > drivers/md/dm-cache-policy-cleaner.c | 7 +-
> > drivers/md/dm-cache-policy-internal.h | 2 +
> > drivers/md/dm-cache-policy-mq.c | 8 +-
> > drivers/md/dm-cache-policy.c | 8 ++
> > drivers/md/dm-cache-policy.h | 2 +
> > drivers/md/dm-cache-target.c | 169 +++++++++++++++++---------
> > drivers/md/dm-thin.c | 11 +-
> > drivers/md/dm-verity.c | 39 +++++-
> > drivers/md/persistent-data/dm-btree-remove.c | 46 +++----
> > 12 files changed, 252 insertions(+), 108 deletions(-)
> >
>
> --
> dm-devel mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/dm-devel

2013-04-06 01:47:54

by Alasdair G Kergon

[permalink] [raw]
Subject: [git pull] device-mapper fixes for 3.9-rc6

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm tags/dm-3.9-fixes-2

to get the following device-mapper fixes for 3.9.

Thanks,
Alasdair

----------------------------------------------------------------
A pair of patches to fix the writethrough mode of the device-mapper
cache target when the device being cached is not itself wrapped with
device-mapper.

----------------------------------------------------------------
Darrick J. Wong (1):
dm cache: fix writes to cache device in writethrough mode

Mike Snitzer (1):
dm cache: reduce bio front_pad size in writeback mode

drivers/md/dm-cache-target.c | 51 +++++++++++++++++++++++++++++++-----------
1 file changed, 38 insertions(+), 13 deletions(-)