<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>192036</bug_id>
          
          <creation_ts>2007-09-10 19:57 0000</creation_ts>
          <short_desc>sys-fs/evms - snapshots don&apos;t work with kernel &gt;=2.6.19</short_desc>
          <delta_ts>2007-12-03 20:13:40 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Applications</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          <bug_file_loc>http://www.nabble.com/Snapshots-in-kernel-2.6.19-t3556671.html</bug_file_loc>
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>gentoobugs@lspeed.org</reporter>
          <assigned_to>dev-zero@gentoo.org</assigned_to>
          <cc>rosenfield.albert@gmail.com</cc>

      

      
          <long_desc isprivate="0">
            <who>gentoobugs@lspeed.org</who>
            <bug_when>2007-09-10 19:57:42 0000</bug_when>
            <thetext>Snapshot objects can be created but not activated - and are therefore of little use.

Reproducible: Always

Steps to Reproduce:
1.Create a snapshot feature object
2.Try to activate it

Actual Results:  
Activation fails, and errors like the following appear in /var/log/evms-engine.log:

Sep 08 12:03:52 bristol _5_ Engine: is_object_change_pending: Change pending: Object testsnap needs to be activated.
Sep 08 12:03:52 bristol _2_ Snapshot: activate_snapshot_parent: Error activating snapshot testsnap
Sep 08 12:03:52 bristol _3_ Engine: activate: Error code 22 activating object testsnap: Invalid argument
Sep 08 12:03:52 bristol _2_ Snapshot: activate_snapshot_parent: Error activating snapshot testsnap
Sep 08 12:03:52 bristol _3_ Engine: activate: Error code 22 activating object testsnap: Invalid argument
Sep 08 12:03:52 bristol _3_ Engine: evms_rediscover: activate() returned error code 22: Invalid argument

Expected Results:  
Activation should succeed, and the snapshot can then be used.

The problem is documented, along with a patch to evms that fixes the issue, here: http://www.nabble.com/Snapshots-in-kernel-2.6.19-t3556671.html. I will attach the patch to this bug for convenience. This problem affected all 3 of my machines running EVMS (AMD64 hardened, AMD64 gentoo, and X86 hardened), and the patch fixed it for all of them.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>gentoobugs@lspeed.org</who>
            <bug_when>2007-09-10 20:01:13 0000</bug_when>
            <thetext>Created an attachment (id=130542)
evms-2.5.5-snapshot.patch

The aforementioned patch...</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>rosenfield.albert@gmail.com</who>
            <bug_when>2007-10-26 09:04:20 0000</bug_when>
            <thetext>I&apos;d like to voice a &quot;please fix!!!&quot; from here too. we are a small hosting company, I have just upgraded a production host for several customer virtual machines, and they are now completely unable to do daily backups.

evms-engine.log:
_5_ Engine: is_object_change_pending: Change pending: Object dom0snap needs to be activated.
_2_ Snapshot: activate_snapshot_parent: Error activating snapshot dom0snap
_3_ Engine: activate: Error code 22 activating object dom0snap: Invalid argument
_2_ Snapshot: activate_snapshot_parent: Error activating snapshot dom0snap
_3_ Engine: activate: Error code 22 activating object dom0snap: Invalid argument
_3_ Engine: evms_rediscover: activate() returned error code 22: Invalid argument
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dev-zero@gentoo.org</who>
            <bug_when>2007-10-26 09:37:52 0000</bug_when>
            <thetext>I know and I&apos;m really sorry, but I didn&apos;t even have time to figure out whether this patch also works with kernels &lt;2.6.19. If someone can assure me that it does, I&apos;ll commit the patch right away.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>rosenfield.albert@gmail.com</who>
            <bug_when>2007-10-26 14:24:06 0000</bug_when>
            <thetext>Do you want a test against an older kernel, or against an older version of libdevicemapper?

In case it doesn&apos;t work, do you expect someone to code a new patch that does?
Being pessimistic for a moment and assuming that it won&apos;t work, I don&apos;t have the ability to create a new patch that does..

But. I think the patch should be applied anyway. Generally speaking, all Linux code is best effort. It calls, it may fail on some API versions, such is life. It&apos;s not like dotnet, where you have a development language and loader framework specifically designed to transparently manage multiple API versions with zero effort. Coding a whole &quot;which version of the kernel am I running on?&quot; jungle into EVMS would be much duplicate effort if it had to be done in all libraries. Rather accept that with regards to version management, we&apos;ll have to wait till the entire Linux community steps up and does something intelligent, and until then the best we can do is fix things on another level (read: ebuild).

With the above paragraph in mind, perhaps we should just update the ebuild to reflect that it can only run on a specific version of the kernel, in case old ones break.

Anyway, I&apos;ll just go see if I can find where the breaker is...

(... hours later ...)

The EVMS sources say that everything is done via a call to ioctl(), so I&apos;d guess that the breakage is in the kernel device mapper driver.

The RedHat folks have helpfully declined GoogleBot access to the livdevmapper commit archive at http://sources.redhat.com/ml/dm-cvs/, and the integrated search function can&apos;t even find itself.

git.kernel.org is rather unhelpful too, requiring an exact kernel version be given before it will search for a path or string.

Nabble seems to be my friend, though :-). It might have nailed something (with a simple search from the front page no less):
http://www.nabble.com/-PATCH-03-25--dm-snapshot%3A-allow-zero-chunk_size-tf2274316.html#a6315352

The above patch is really old (sept 2006), but seems to apply to 2.6.18-rc7. Odd.

Either way, the patch above says that the old version accepts anything with at least 4 parameters! So applying the patch should be safe for old kernel versions too - as long as it keeps a minimum of 4 parameters..

(Nasty patch by the way, it rips out code comments explaining more-or-less doubtful logic in the code, leaving just the code to &quot;explain&quot;.)

Phew. My apologies for writing a novel.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dev-zero@gentoo.org</who>
            <bug_when>2007-10-27 11:12:04 0000</bug_when>
            <thetext>Albert: Which kernel did you use before updating?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>rosenfield.albert@gmail.com</who>
            <bug_when>2007-10-29 18:36:03 0000</bug_when>
            <thetext>kernel before: 2.6.16.18-xen
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>rosenfield.albert@gmail.com</who>
            <bug_when>2007-10-30 13:05:29 0000</bug_when>
            <thetext>devzero:
So, what have you decided?
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dev-zero@gentoo.org</who>
            <bug_when>2007-10-30 16:21:26 0000</bug_when>
            <thetext>Well, I tested evms with gentoo-sources-2.6.16-r13 and EVMS didn&apos;t run at all there (somehow the volumes didn&apos;t show up in /dev/evms), but there were no particular errors about snapshotting.
I&apos;ll see that I push out revision bump until the end of the week including the patch.
As a security measurement I&apos;ll add a warning if a running kernel before 2.6.19 is being detected.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>rosenfield.albert@gmail.com</who>
            <bug_when>2007-10-30 17:18:25 0000</bug_when>
            <thetext>&gt; (somehow the volumes didn&apos;t show up in /dev/evms)

The snapshot volumes, or every volume?
The snapshot volumes are unlinked by evms_activate when the dm table setup fails.

(If it&apos;s every volume, perhaps something with the udev version)

&gt; I&apos;ll see that I push out revision bump until the end of the week
&gt; including the patch. As a security measurement I&apos;ll add a warning
&gt; if a running kernel before 2.6.19 is being detected.

Beautiful...

(Can&apos;t wait to get hold of a new version; I just have this feeling that now that backups are down something is going to happen that we wish we had &apos;em ;-)..)
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>dev-zero@gentoo.org</who>
            <bug_when>2007-12-03 20:13:40 0000</bug_when>
            <thetext>Finally fixed. Sorry for the delay.</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>130542</attachid>
            <date>2007-09-10 20:01 0000</date>
            <desc>evms-2.5.5-snapshot.patch</desc>
            <filename>evms-2.5.5-snapshot.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIGV2bXMtMi41LjUvZW5naW5lL2RtLXRhcmdldHMuYy5vcmlnCTIwMDUtMTEtMDcgMTU6NDY6
NDEuMDAwMDAwMDAwICswMDAwCisrKyBldm1z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aW4ubWlub3IsCiAJCQkgc25hcHNob3QtPnNu
YXBzaG90Lm1ham9yLCBzbmFwc2hvdC0+c25hcHNob3QubWlub3IsCi0JCQkgKHNuYXBzaG90LT5w
ZXJzaXN0ZW50KSA/ICdwJyA6ICduJywgc25hcHNob3QtPmNodW5rX3NpemUsCi0JCQkgc25hcHNo
b3QtPm9yaWdpbl9wYXJlbnQubWFqb3IsCi0JCQkgc25hcHNob3QtPm9yaWdpbl9wYXJlbnQubWlu
b3IpOworCQkJIChzbmFwc2hvdC0+cGVyc2lzdGVudCkgPyAncCcgOiAnbicsIHNuYXBzaG90LT5j
aHVua19zaXplKTsKIAkJcmMgPSAwOwogCX0KIAo=
</data>        

          </attachment>
    </bug>

</bugzilla>