Bug 201751

Summary: lvcreate doesn't lockfs the origin filesystem when creating the first snapshot
Product: [Fedora] Fedora Reporter: Jan Blunck <jblunck>
Component: lvm2Assignee: Alasdair Kergon <agk>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6CC: dwysocha, mbroz
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-07-19 20:11:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Blunck 2006-08-08 18:20:03 UTC
Description of problem:
lvcreate doesn't lockfs the origin filesystem when creating the first snapshot.
This leads to unusable snapshots because the filesystem isn't synced before
creating the snapshot.

Version-Release number of selected component (if applicable):
2.02.08

How reproducible:
easily

Steps to Reproduce:
1. Create LV test on VG test with ext3 filesystem
2. lvcreate -s -L 320M -n snap1 -p r test/test
3. mount -r /dev/test/snap1 /mnt
  
Actual results:
s390vm01:~ # mount -r /dev/test/snap1 /tmp/m1
EXT3-fs: INFO: recovery required on readonly filesystem.
EXT3-fs: write access unavailable, cannot proceed. 
mount: wrong fs type, bad option, bad superblock on /dev/test/snap1,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

Expected results:


Additional info:
The problem is in lib/activate/dev_manager.c:
                if (!lv_is_origin(lv) && !lv_is_cow(lv))
                        dm_tree_skip_lockfs(root);

When creating the first snapshot of a LV lv_is_origin() is still false because
we suspend the LV before creating the snapshot. Therefore the original LV is
suspended without lockfs.

Comment 1 Alasdair Kergon 2006-08-08 21:21:54 UTC
Proposed fix:
  http://sources.redhat.com/ml/lvm2-cvs/2006-08/msg00001.html

Test set should include every command that does a suspend:

lvchange -ay (of all object types), lvcreate first snapshot, lvcreate second
snapshot of same device, lvremove second snapshot, lvchange --refresh, pvmove,
vgreduce --removemissing, lvresize, lvrename, lvconvert


Comment 2 Fedora Update System 2007-01-10 20:27:47 UTC
lvm2-2.02.17-1.fc6 has been pushed for fc6, which should resolve this issue.  If these problems are still present in this version, then please make note of it in this bug report.

Comment 3 Fedora Update System 2007-01-22 17:02:23 UTC
lvm2-2.02.17-1.fc6 has been pushed for fc6, which should resolve this issue.  If these problems are still present in this version, then please make note of it in this bug report.

Comment 4 Corey Marthaler 2007-01-24 20:35:05 UTC
Verified fixed in lvm2-2.02.19-1.el4.

[root@link-08 ~]# lvs
  LV     VG   Attr   LSize   Origin Snap%  Move Log Copy%
  origin vg   owi-a- 600.00M
  snap1  vg   sri-a- 320.00M origin   0.00

[root@link-08 ~]# mount -r /dev/vg/snap1 /mnt/snap

Jan 24 09:48:54 link-08 kernel: kjournald starting.  Commit interval 5 seconds
Jan 24 09:48:54 link-08 kernel: EXT3-fs: mounted filesystem with ordered data mode.

I also ran some of the other commands mentioned in comment #1