blob: b75affe75306e8e80ed45f79ac4c7b44e4f62689 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
Data inconsistency on LVM logical volume mounted as partition on ubuntu guest, when the written file's size is equal or greater than 27G.
Description of problem:
On the guest, writing a 27Gib file or larger result in inconsistent file checksum upon subsequent read.
Steps to reproduce:
**On the host**
0. Create a LVM logical volume on a Linux RAID 1 (with 1 disk only)
```
--- Logical volume ---
LV Path /dev/davidahw2-vg4/lv0
LV Name lv0
VG Name davidahw2-vg4
LV UUID 5FbDcl-eSDe-7cXL-22tj-Lg6O-79AL-4Gq7gx
LV Write Access read/write
LV Creation host, time davida-hw2, 2021-12-06 16:45:00 +0800
LV Status available
# open 1
LV Size <7.28 TiB
Current LE 1907688
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:4
--- Segments ---
Logical extents 0 to 1907687:
Type linear
Physical volume /dev/md4
Physical extents 0 to 1907687
```
1. Format the logical volume as ext4
```
mkfs -t ext4 /dev/davidahw2-vg4/lv0
```
2. Create a libvirt x86 64bits Ubuntu 22.04 machine mounting a LVM logical volume
```
<controller type='scsi' index='1' model='virtio-scsi'><driver queues='8' iothread='2'/></controller>
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source dev='/dev/davidahw2-vg4/lv0'/>
<target dev='sdd' bus='scsi'/>
<blockio logical_block_size='512' physical_block_size='4096'/>
<address type='drive' controller='1' bus='0' target='1' unit='0'/>
</disk>
```
**On the guest**
3. Mount libvirt/qemu provided block device /dev/sdd as ext4 partition
```
mount /dev/sdd /mnt/test
```
4. Write **27G file** or larger **on the guest** causing the **2nd checksum to be different**
```
sync; head -c 27G </dev/urandom >myfile; sha256sum myfile; sha256sum myfile
8d3b4b263961d2c510390f99879be89b4b9134dc588139ede75573be1590115b myfile
a8e886b3c39d9b4721e582c5e2ca25c76ff6561750ac6dc7aa7e70404661d1cf myfile <== ERROR: Inconsistent checksum
```
5. Write **26G file** or larger **on the guest** and **both checksum are the same**
```
sync; head -c 26G </dev/urandom >myfile; sha256sum myfile; sha256sum myfile
598ac5da9b5bfa14d0ee664ae2590e09da772cba64cbc83ec049a656223c9401 myfile
598ac5da9b5bfa14d0ee664ae2590e09da772cba64cbc83ec049a656223c9401 myfile <== CORRECT: Consistent checksum
```
**Important**:
- With the VM shutdown, the same commands on the same mounted ext4 partition **on the host** has consistent checksum every time for file sizes from 20G to 40G.
- The disk has no sign of failure (no badblocks reported to the filesystem, MD raid reports a healthy raid setup, smart reports on error)
Additional information:
|