linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] lvm filter not ignoring block device
@ 2017-12-18 16:48 Thanos Makatos
  2017-12-18 16:55 ` Alasdair G Kergon
  0 siblings, 1 reply; 3+ messages in thread
From: Thanos Makatos @ 2017-12-18 16:48 UTC (permalink / raw)
  To: linux-lvm

I'm trying to do a very simple test were a single block device should
be ignored by LVM as a result of setting the filter directive in
lvm.conf. However, it isn't. That block device happens to be a DM
target (mapped to the zero target):

# dmsetup create foo7 --table "0 $((1*1024*1024*1024/512)) zero"

The filter in lvm.conf is not honored, here's how it's set:

devices {
     ...
     filter = [ "r|/dev/mapper/foo7|" ]
     ...
}

I did run vgscan after editing lvm.conf. The relevant output of strace:

# strace -o strace lvs -vvvv -d > lvs 2>&1
...
stat("/dev/mapper/foo7", {st_mode=S_IFBLK|0660, st_rdev=makedev(253,
4), ...}) = 0
open("/dev/mapper/foo7", O_RDONLY|O_DIRECT|O_NOATIME) = 5
fstat(5, {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 4), ...}) = 0
write(2, "#device/dev-io.c:533         ", 29) = 29
write(2, "Opened /dev/mapper/foo7 RO O_DIR"..., 35) = 35
write(2, "\n", 1)                       = 1
ioctl(5, BLKGETSIZE64, 1073741824)      = 0
write(2, "#device/dev-io.c:310       ", 27) = 27
write(2, "/dev/mapper/foo7: size is 209715"..., 41) = 41
write(2, "\n", 1)                       = 1
close(5)                                = 0
write(2, "#device/dev-io.c:587         ", 29) = 29
write(2, "Closed /dev/mapper/foo7", 23) = 23
write(2, "\n", 1)                       = 1
write(2, "#ioctl/libdm-iface.c:1795       "..., 34) = 34
write(2, "dm status   (253:4) OF   [16384]"..., 37) = 37
write(2, "\n", 1)                       = 1
ioctl(4, DM_TABLE_STATUS, 0x7fa013383190) = 0
stat("/dev/mapper/foo7", {st_mode=S_IFBLK|0660, st_rdev=makedev(253,
4), ...}) = 0
open("/dev/mapper/foo7", O_RDONLY|O_DIRECT|O_NOATIME) = 5
fstat(5, {st_mode=S_IFBLK|0660, st_rdev=makedev(253, 4), ...}) = 0
write(2, "#device/dev-io.c:533         ", 29) = 29
write(2, "Opened /dev/mapper/foo7 RO O_DIR"..., 35) = 35
write(2, "\n", 1)                       = 1
ioctl(5, BLKBSZGET, 4096)               = 0
write(2, "#device/dev-io.c:144         ", 29) = 29
write(2, "/dev/mapper/foo7: block size is "..., 42) = 42
write(2, "\n", 1)                       = 1
ioctl(5, BLKPBSZGET, 512)               = 0
write(2, "#device/dev-io.c:155         ", 29) = 29
write(2, "/dev/mapper/foo7: physical block"..., 50) = 50
write(2, "\n", 1)                       = 1
lseek(5, 0, SEEK_SET)                   = 0
read(5,

It's stuck forever in read(2). And the output of lvs -vvvv -d:

# grep -E "foo7|dm-4" lvs
#device/dev-cache.c:338         /dev/dm-4: Added to device cache
#device/dev-cache.c:335         /dev/mapper/foo7: Aliased to /dev/dm-4
in device cache (preferred name)
#device/dev-cache.c:335         /dev/disk/by-id/dm-name-foo7: Aliased
to /dev/mapper/foo7 in device cache
#device/dev-cache.c:335         /dev/block/253:4: Aliased to
/dev/mapper/foo7 in device cache
#device/dev-io.c:533         Opened /dev/mapper/foo7 RO O_DIRECT
#device/dev-io.c:310       /dev/mapper/foo7: size is 2097152 sectors
#device/dev-io.c:587         Closed /dev/mapper/foo7
#device/dev-io.c:533         Opened /dev/mapper/foo7 RO O_DIRECT
#device/dev-io.c:144         /dev/mapper/foo7: block size is 4096 bytes
#device/dev-io.c:155         /dev/mapper/foo7: physical block size is 512 bytes

The LVM version is:

# lvm version
  LVM version:     2.02.118(2)-RHEL6 (2015-09-08)
  Library version: 1.02.95-RHEL6 (2015-09-08)
  Driver version:  4.33.1

Is this how it's supposed to work? Am I missing something?

-- 
Thanos Makatos

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] lvm filter not ignoring block device
  2017-12-18 16:48 [linux-lvm] lvm filter not ignoring block device Thanos Makatos
@ 2017-12-18 16:55 ` Alasdair G Kergon
  2017-12-18 17:01   ` Thanos Makatos
  0 siblings, 1 reply; 3+ messages in thread
From: Alasdair G Kergon @ 2017-12-18 16:55 UTC (permalink / raw)
  To: Thanos Makatos; +Cc: linux-lvm

On Mon, Dec 18, 2017 at 04:48:19PM +0000, Thanos Makatos wrote:
>      filter = [ "r|/dev/mapper/foo7|" ]

Try setting global_filter.

Alasdair

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-lvm] lvm filter not ignoring block device
  2017-12-18 16:55 ` Alasdair G Kergon
@ 2017-12-18 17:01   ` Thanos Makatos
  0 siblings, 0 replies; 3+ messages in thread
From: Thanos Makatos @ 2017-12-18 17:01 UTC (permalink / raw)
  To: Thanos Makatos, linux-lvm

On 18 December 2017 at 16:55, Alasdair G Kergon <agk@redhat.com> wrote:
> On Mon, Dec 18, 2017 at 04:48:19PM +0000, Thanos Makatos wrote:
>>      filter = [ "r|/dev/mapper/foo7|" ]
>
> Try setting global_filter.

It worked, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-18 17:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-18 16:48 [linux-lvm] lvm filter not ignoring block device Thanos Makatos
2017-12-18 16:55 ` Alasdair G Kergon
2017-12-18 17:01   ` Thanos Makatos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).