+++ This bug was initially created as a clone of Bug #642575 +++ RHEL 5.6 clone Description of problem: Some filters filter devices wrongly. The original cmd: /sbin/pvs --config " devices { preferred_names = [\"^/dev/mapper/\"] write_cache_state=0 filter = [ \"a%/dev/mapper/36000402004ec06f56089aa1400000000|/dev/mapper/36000402004ec06f56089ab3a00000000|/dev/mapper/36000402004ec06f5608a865500000000%\", \"r%.*%\" ] } " This is an irc log excerpt that shows agk trying to narrow down the issue. [Tuesday 12 October 2010] [19:03:01] <agk> so it's do with pulling the suffix out [Tuesday 12 October 2010] [19:03:12] <agk> /sbin/pvs --config " devices { write_cache_state=0 filter = [ \"a%8(9aa140000000|9ab3a0000000|a86550)%\", \"r%.*%\" ] } " [Tuesday 12 October 2010] [19:03:15] <agk> vs [Tuesday 12 October 2010] [19:03:26] <agk> /sbin/pvs --config " devices { write_cache_state=0 filter = [ \"a%8(9aa140000000|9ab3a0000000|a8655)%\", \"r%.*%\" ] } " [Tuesday 12 October 2010] [19:03:44] <agk> removing that last '0' it starts to work again [Tuesday 12 October 2010] [19:04:51] <agk> So the simplest case so far: [Tuesday 12 October 2010] [19:04:56] <agk> "a%8(9aa140|9ab3a0|a86550)%\ fails [Tuesday 12 October 2010] [19:05:11] <agk> a%8(9aa140|9ab3a|a86550)%\ [Tuesday 12 October 2010] [19:05:12] <agk> works [Tuesday 12 October 2010] [19:05:36] <agk> so it must be going wrong when it sees a common suffix (0) and pulls it out of the expression [Tuesday 12 October 2010] [19:06:30] <agk> but if there are only 2 things instead of 3 between the |s it works ok [Tuesday 12 October 2010] [19:10:48] <agk> So: /tmp/bothcmd2 is my simplest test case so far [Tuesday 12 October 2010] [19:10:55] <agk> bothcmds2 [Tuesday 12 October 2010] [19:11:07] <agk> it runs two supposedly identical cmds but gets different output --- Additional comment from agk on 2010-10-22 17:03:21 EDT --- Well the conclusion from irc was that removing a common suffix was broken. But other parts of this code were changed since that was added, so we might find rather than fixing that, removing it no longer makes any noticeable performance difference. So (1) try removing that optimisation and see how much it slows things down; or (2) try to fix the optimisation. --- Additional comment from agk on 2010-11-02 16:02:06 EDT --- Patch added upstream for 2.02.76. The optimiser was ignoring '| d e' and factoring out 'a' to convert a b | (a c | d e) into a (b | c | d e). --- Additional comment from agk on 2010-11-08 06:16:50 EST --- http://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f56361e29fa9dc72a3966d0a45ab027a1d104923 http://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=86a974c3c344de8e6265700a8dbbabb210c0026a
Patch is part of device-mapper library, fixing component.
Fix in device-mapper-1.02.55-2.el5.
Fix verified in the latest rpms. 2.6.18-227.el5 lvm2-2.02.74-3.el5 BUILT: Thu Nov 11 02:56:33 CST 2010 lvm2-cluster-2.02.74-3.el5 BUILT: Tue Nov 9 08:01:59 CST 2010 device-mapper-1.02.55-2.el5 BUILT: Tue Nov 9 06:41:00 CST 2010 cmirror-1.1.39-10.el5 BUILT: Wed Sep 8 16:32:05 CDT 2010 kmod-cmirror-0.1.22-3.el5 BUILT: Tue Dec 22 13:39:47 CST 2009 Scan without a filter: [root@taft-01 ~]# pvscan PV /dev/sdb1 VG vg1 lvm2 [135.66 GB / 135.54 GB free] PV /dev/sdc1 VG vg1 lvm2 [135.66 GB / 135.54 GB free] PV /dev/sdd1 VG vg1 lvm2 [135.66 GB / 135.54 GB free] PV /dev/sde1 VG vg1 lvm2 [135.66 GB / 135.54 GB free] Scan with a regex filter: filter = [ "r|hda|hdc|sdc|" ] [root@taft-01 ~]# pvscan Couldn't find device with uuid xQIPUk-CLBd-fJcL-qhGR-TzcR-Iyme-V1gp3G. PV /dev/sdb1 VG vg1 lvm2 [135.66 GB / 135.54 GB free] PV unknown device VG vg1 lvm2 [135.66 GB / 135.54 GB free] PV /dev/sdd1 VG vg1 lvm2 [135.66 GB / 135.54 GB free] PV /dev/sde1 VG vg1 lvm2 [135.66 GB / 135.54 GB free]
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Filtering with regular expressions (for example when using lvm commands to filter devices) could have failed. This was due to an error in removing a common suffix. With this update, the optimization for common suffixes works correctly.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-0051.html