References: <3cc84c6a-62d0-96c2-cf6e-9181577f9802@suse.com> <662c133e-cebe-1882-a086-edb2219af7f0@redhat.com> <4e175852-fd38-2096-a174-046e10af941f@suse.com> <8b345d98-abf5-b3f8-50fc-5d86d20fd060@redhat.com> From: Zdenek Kabelac Message-ID: Date: Thu, 6 Jun 2019 15:51:15 +0200 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [linux-lvm] confused with lvm2 filter rules Reply-To: LVM general discussion and development List-Id: LVM general discussion and development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , List-Id: Content-Type: text/plain; charset="us-ascii"; format="flowed" To: Heming Zhao , LVM general discussion and development Dne 06. 06. 19 v 15:30 Heming Zhao napsal(a): > Hello, > > the filter is: > filter = [ "r|/dev/.*/by-path/.*|", "r|/dev/.*/by-id/.*|", > "r|/dev/fd.*|", "r|/dev/cdrom|", "a/.*/" ] > > if filter doesn't contain "a/.*/": > - pvcreate, vgcreate & vgextend use regex filter to reject the disk. > (correct logic) > > if filter contains "a/.*/": > - regex fileter pass the disk under pvcreate/vgcreate, create successfully. > - regex filter reject the disk under vgextend. (wrong. should create > successfuly) > - vgextend should do the same action as pvcreate/vgcreate. Hi As has been said - when you put a|.*| as the last rule - it's doing something different then you may think. So please do NOT test with such filter (I've been even planning to add 'WARNING:' message when lvm2 would spot such filter....) > log as below (with filter contain: "a/.*/"): Not really interesting trace - the filter works correctly for this case. The best advice is - DO NOT USE IT set this way. Code is correct and there is no bug - it's just non-trivial to understand what just filter is doing. Behavior cannot be changed without causing regression for other users that set filters correctly. So do you have any buggy trace for correctly set filter ? Regards Zdenek