Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 935795 Details for
Bug 1139216
MD metadata version 1.0 confusing LVM tools using lvmetad, ending up with "No device found for PV" message
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
proposed patch
patch.diff (text/plain), 7.67 KB, created by
Petr Rockai
on 2014-09-09 15:26:43 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Petr Rockai
Created:
2014-09-09 15:26:43 UTC
Size:
7.67 KB
patch
obsolete
>commit 1639bd2847ffc53352d8f74304403176b3807806 >Author: Petr Rockai <prockai@redhat.com> >Date: Tue Sep 9 17:25:29 2014 +0200 > > test: Add a test for MD component detection in pvscan --cache. > >diff --git a/test/shell/lvmetad-pvscan-md.sh b/test/shell/lvmetad-pvscan-md.sh >new file mode 100644 >index 0000000..dd85bb6 >--- /dev/null >+++ b/test/shell/lvmetad-pvscan-md.sh >@@ -0,0 +1,77 @@ >+#!/bin/sh >+# Copyright (C) 2014 Red Hat, Inc. All rights reserved. >+# >+# This copyrighted material is made available to anyone wishing to use, >+# modify, copy, or redistribute it subject to the terms and conditions >+# of the GNU General Public License v.2. >+# >+# You should have received a copy of the GNU General Public License >+# along with this program; if not, write to the Free Software Foundation, >+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA >+ >+. lib/inittest >+ >+test -e LOCAL_LVMETAD || skip >+which mdadm || skip >+ >+test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \ >+ modprobe raid0 || skip >+ >+aux lvmconf 'devices/md_component_detection = 1' >+aux extend_filter_LVMTEST >+aux extend_filter "a|/dev/md.*|" >+ >+aux prepare_devs 2 >+ >+# TODO factor out the following MD-creation code into lib/ >+ >+# Have MD use a non-standard name to avoid colliding with an existing MD device >+# - mdadm >= 3.0 requires that non-standard device names be in /dev/md/ >+# - newer mdadm _completely_ defers to udev to create the associated device node >+mdadm_maj=$(mdadm --version 2>&1 | perl -pi -e 's|.* v(\d+).*|\1|') >+[ $mdadm_maj -ge 3 ] && \ >+ mddev=/dev/md/md_lvm_test0 || \ >+ mddev=/dev/md_lvm_test0 >+ >+cleanup_md() { >+ # sleeps offer hack to defeat: 'md: md127 still in use' >+ # see: https://bugzilla.redhat.com/show_bug.cgi?id=509908#c25 >+ aux udev_wait >+ mdadm --stop "$mddev" || true >+ aux udev_wait >+ if [ -b "$mddev" ]; then >+ # mdadm doesn't always cleanup the device node >+ sleep 2 >+ rm -f "$mddev" >+ fi >+} >+ >+cleanup_md_and_teardown() { >+ cleanup_md >+ aux teardown >+} >+ >+# create 2 disk MD raid0 array (stripe_width=128K) >+test -b "$mddev" && skip >+mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 64 "$dev1" "$dev2" >+trap 'cleanup_md_and_teardown' EXIT # cleanup this MD device at the end of the test >+test -b "$mddev" || skip >+cp -LR "$mddev" "$DM_DEV_DIR" # so that LVM/DM can see the device >+lvmdev="$DM_DEV_DIR/md_lvm_test0" >+ >+# TODO end MD-creation code >+ >+# maj=$(($(stat -L --printf=0x%t "$dev2"))) >+# min=$(($(stat -L --printf=0x%T "$dev2"))) >+ >+pvcreate $lvmdev >+ >+pvscan --cache "$lvmdev" >+ >+# ensure that lvmetad can only see the toplevel MD device >+not pvscan --cache "$dev1" 2>&1 | grep "not found" >+not pvscan --cache "$dev2" 2>&1 | grep "not found" >+ >+pvs | grep $lvmdev >+pvs | not grep $dev1 >+pvs | not grep $dev2 > >commit 3685a51679e03ecd494063601161992dbe3bff22 >Author: Petr Rockai <prockai@redhat.com> >Date: Tue Sep 9 17:16:40 2014 +0200 > > lvmetad: Re-organise filters to properly avoid scans of component devices. > > If a PV label is exposed both through a composite device (MD for example) and > through its component devices, we always want the PV that lvmetad sees to be the > composite, since this is what all LVM commands (including activation) will then > use. If pvscan --cache is triggered for multiple clones of the same PV, the last > to finish wins. This patch basically re-arranges the filters so that > component-device filters are part of the global_filter chain, not of the > client-side filter chain. This has a subtle effect on filter evaluation order, > but should not alter visible semantics in the non-lvmetad case. > >diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c >index fe79a81..5bf5cbf 100644 >--- a/lib/commands/toolcontext.c >+++ b/lib/commands/toolcontext.c >@@ -861,11 +861,9 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd) > } > > /* regex filter. Optional. */ >- if (!(cn = find_config_tree_node(cmd, devices_filter_CFG, NULL))) >- log_very_verbose("devices/filter not found in config file: " >- "no regex filter installed"); >- else if (!(filters[nr_filt] = regex_filter_create(cn->v))) { >- log_error("Failed to create regex device filter"); >+ if ((cn = find_config_tree_node(cmd, devices_global_filter_CFG, NULL)) && >+ !(filters[nr_filt] = regex_filter_create(cn->v))) { >+ log_error("Failed to create global regex device filter"); > goto bad; > } else > nr_filt++; >@@ -918,16 +916,26 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache > > cmd->dump_filter = 0; > >- if (!(f3 = _init_filter_components(cmd))) >+ if (!(cmd->lvmetad_filter = _init_filter_components(cmd))) > goto_bad; > > init_ignore_suspended_devices(find_config_tree_bool(cmd, devices_ignore_suspended_devices_CFG, NULL)); > init_ignore_lvm_mirrors(find_config_tree_bool(cmd, devices_ignore_lvm_mirrors_CFG, NULL)); > >+ if ((cn = find_config_tree_node(cmd, devices_filter_CFG, NULL))) { >+ if (!(f3 = regex_filter_create(cn->v))) >+ goto_bad; >+ toplevel_components[0] = cmd->lvmetad_filter; >+ toplevel_components[1] = f3; >+ if (!(f4 = composite_filter_create(2, toplevel_components))) >+ goto_bad; >+ } else >+ f4 = cmd->lvmetad_filter; >+ > if (!(dev_cache = find_config_tree_str(cmd, devices_cache_CFG, NULL))) > goto_bad; > >- if (!(f4 = persistent_filter_create(cmd->dev_types, f3, dev_cache))) { >+ if (!(cmd->filter = persistent_filter_create(cmd->dev_types, f4, dev_cache))) { > log_verbose("Failed to create persistent device filter."); > goto bad; > } >@@ -948,29 +956,20 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache > load_persistent_cache && !cmd->is_long_lived && > !stat(dev_cache, &st) && > (st.st_ctime > config_file_timestamp(cmd->cft)) && >- !persistent_filter_load(f4, NULL)) >+ !persistent_filter_load(cmd->filter, NULL)) > log_verbose("Failed to load existing device cache from %s", > dev_cache); > >- if (!(cn = find_config_tree_node(cmd, devices_global_filter_CFG, NULL))) { >- cmd->filter = f4; >- } else if (!(cmd->lvmetad_filter = regex_filter_create(cn->v))) >- goto_bad; >- else { >- toplevel_components[0] = cmd->lvmetad_filter; >- toplevel_components[1] = f4; >- if (!(cmd->filter = composite_filter_create(2, toplevel_components))) >- goto_bad; >- } >- > return 1; > bad: >- if (f4) >+ if (f4) /* kills both f3 and cmd->lvmetad_filter */ > f4->destroy(f4); >- else if (f3) >- f3->destroy(f3); >- if (toplevel_components[0]) >- toplevel_components[0]->destroy(toplevel_components[0]); >+ else { >+ if (f3) >+ f3->destroy(f3); >+ if (cmd->lvmetad_filter) >+ cmd->lvmetad_filter->destroy(cmd->lvmetad_filter); >+ } > return 0; > } > > >commit 66cce64e6985f7f1614c6bde618c7a4207fea7e9 >Author: Petr Rockai <prockai@redhat.com> >Date: Tue Sep 9 17:14:35 2014 +0200 > > dev-cache: Filter wipe does not guarantee a full /dev scan. > > The code in dev_iter_create assumes that if a filter can be wiped, doing so will > always trigger a call to _full_scan. This is not true for composite filters > though, since they can always be wiped in principle, but there is no way to know > that a component filter inside will exist that actually triggers the scan. > >diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c >index 1d7a517..ba4ee54 100644 >--- a/lib/device/dev-cache.c >+++ b/lib/device/dev-cache.c >@@ -1009,9 +1009,11 @@ struct dev_iter *dev_iter_create(struct dev_filter *f, int dev_scan) > if (dev_scan && !trust_cache()) { > /* Flag gets reset between each command */ > if (!full_scan_done()) { >- if (f && f->wipe) >- f->wipe(f); /* Calls _full_scan(1) */ >- else >+ if (f && f->wipe) { >+ f->wipe(f); /* might call _full_scan(1) */ >+ if (!full_scan_done()) >+ _full_scan(1); >+ } else > _full_scan(1); > } > } else
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1139216
:
935324
| 935795