Bug 2090391

Summary: lvm shell broken for lvmdbusd when using ./configure --enable-editline --disable-readline ...
Product: Red Hat Enterprise Linux 9 Reporter: Tony Asleson <tasleson>
Component: lvm2Assignee: Tony Asleson <tasleson>
lvm2 sub component: Command-line tools QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, cmarthal, heinzm, jbrassow, mcsontos, msnitzer, prajnoha, thornber, zkabelac
Version: 9.1Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: lvm2-2.03.16-3.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 11:20:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tony Asleson 2022-05-25 16:20:59 UTC
Description of problem:

lvmdbusd can utilize the lvm shell to reduce fork & exec overhead for operation.  However, when you compile lvm using

$ ./configure --enable-editline --disable-readline ...

The lvmdbusd get stuck waiting for "lvm> " on stdout which never happens.  There appears to be subtle difference between the two implementations of readline() or some other bug in lvm on the usage of each implementation.


Version-Release number of selected component (if applicable):
# lvm version
  LVM version:     2.03.15(2)-git (2021-10-20)
  Library version: 1.02.183-git (2021-10-20)
  Driver version:  4.45.0
  Configuration:   ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-default-dm-run-dir=/run --with-default-run-dir=/run/lvm --with-default-pid-dir=/run --with-default-locking-dir=/run/lock/lvm --with-usrlibdir=/usr/lib64 --enable-fsadm --enable-write_install --with-user= --with-group= --with-device-uid=0 --with-device-gid=6 --with-device-mode=0660 --enable-pkgconfig --enable-cmdlib --enable-dmeventd --enable-blkid_wiping --with-cluster=internal --with-udevdir=/usr/lib/udev/rules.d --enable-udev_sync --with-thin=internal --with-cache=internal --enable-lvmpolld --enable-lvmlockd-dlm --enable-lvmlockd-dlmcontrol --enable-lvmlockd-sanlock --enable-dbus-service --enable-notify-dbus --enable-dmfilemapd --with-writecache=internal --with-vdo=internal --with-vdo-format=/usr/bin/vdoformat --with-integrity=internal --with-default-use-devices-file=1 --disable-silent-rules --enable-app-machineid --enable-editline --disable-readline


How reproducible:
100%


Steps to Reproduce:
1. Run lvmdbusd and set the mode to lvm shell
2. Try to use dbus interface
3. Get errors

Actual results:
Errors returned to dbus client


Expected results:
Operations to complete successfully


Additional info:

Comment 1 Tony Asleson 2022-05-27 15:12:33 UTC
This might be the cause:

https://github.com/troglobit/editline/blob/9fa05ba3841f3a7776b0b3645a3a92f32259d988/src/editline.c#L1571

If the FD doesn't refer to a tty, the prompt appears to be discarded?

If that is the case it explains why it works when you use it interactively,
but fails when we use it with lvmdbusd, as the FD wouldn't be considered a tty.

Comment 2 Zdenek Kabelac 2022-05-27 15:31:26 UTC
lvmdbusd should be running with --yes option set in some way.

Otherwise with closed  'stdin'  means automatically  'no'  answer to any prompt.

Although it would be 'weird' if  'libreadline' would 'magically' self opening stdin.

Also as a daemon process lvmdbusd should be reopening it's own descriptors and detaching from passed ones (and keep standard  stdin/out/err only upon option).

Comment 3 Tony Asleson 2022-06-01 17:27:50 UTC
I have a local change which allows lvmdbusd to work with the lvm shell regardless if we get the "lvm> " 
prompt or not.  Once the change is fully tested I will put out for review and merge.

Comment 7 Tony Asleson 2022-08-04 18:55:50 UTC
Root cause for hang in test_pv_scan has been identified, a separate bz has been written.
Excluding the test_pv_scan unit test we run successfully on QA system, issue can be considered
verified.

# LVM_DBUSD_TEST_MODE=1 ./lvmdbustest.py -v

*** Testing only lvm shell mode ***

Testing TMO=0

Successfully changed execution mode to "lvm shell (non-fork)"
test_cache_lv_create (__main__.TestDbusService) ... ok
test_cache_lv_rename (__main__.TestDbusService)
Make sure that if we rename a cache lv that we correctly handle the ... ok
test_cache_pool_create (__main__.TestDbusService) ... ok
test_external_lv_create (__main__.TestDbusService) ... ok
test_external_pv_create (__main__.TestDbusService) ... ok
test_external_vg_create (__main__.TestDbusService) ... ok
test_invalid_names (__main__.TestDbusService) ... ok
test_invalid_tags (__main__.TestDbusService) ... ok
test_job_handling (__main__.TestDbusService) ... ok
test_job_handling_timer (__main__.TestDbusService) ... ok
test_lookup_by_lvm_id (__main__.TestDbusService) ... ok
test_lv_activate_deactivate (__main__.TestDbusService) ... ok
test_lv_create (__main__.TestDbusService) ... ok
test_lv_create_job (__main__.TestDbusService) ... ok
test_lv_create_linear (__main__.TestDbusService) ... ok
test_lv_create_mirror (__main__.TestDbusService) ... ok
test_lv_create_pv_specific (__main__.TestDbusService) ... ok
test_lv_create_raid (__main__.TestDbusService) ... ok
test_lv_create_rounding (__main__.TestDbusService) ... ok
test_lv_create_striped (__main__.TestDbusService) ... ok
test_lv_create_thin_pool (__main__.TestDbusService) ... ok
test_lv_interface_cache_lv (__main__.TestDbusService) ... ok
test_lv_interface_plain_lv (__main__.TestDbusService) ... ok
test_lv_interface_thin_pool_lv (__main__.TestDbusService) ... ok
test_lv_interface_vdo_lv (__main__.TestDbusService) ... ok
test_lv_interface_vdo_pool_lv (__main__.TestDbusService) ... ok
test_lv_move (__main__.TestDbusService) ... ok
test_lv_on_thin_pool_rename (__main__.TestDbusService) ... ok
test_lv_remove (__main__.TestDbusService) ... ok
test_lv_rename (__main__.TestDbusService) ... ok
test_lv_resize (__main__.TestDbusService) ... ok
test_lv_resize_same (__main__.TestDbusService) ... ok
test_lv_snapshot (__main__.TestDbusService) ... ok
test_lv_tags (__main__.TestDbusService) ... ok
test_lv_thinpool_rename (__main__.TestDbusService) ... ok
test_meta_lv_data_lv_props (__main__.TestDbusService) ... ok
test_move (__main__.TestDbusService) ... ok
test_nesting (__main__.TestDbusService) ... ok
test_prop_get (__main__.TestDbusService) ... ok
test_pv_allocation (__main__.TestDbusService) ... ok
test_pv_remove_add (__main__.TestDbusService) ... ok
test_pv_resize (__main__.TestDbusService) ... ok
test_pv_scan (__main__.TestDbusService) ... skipped 'skipping pv scan test due to known issue'
test_pv_symlinks (__main__.TestDbusService) ... ok
test_pv_tags (__main__.TestDbusService) ... ok
test_refresh (__main__.TestDbusService) ... ok
test_snapshot_merge (__main__.TestDbusService) ... ok
test_snapshot_merge_thin (__main__.TestDbusService) ... ok
test_tag_names (__main__.TestDbusService) ... ok
test_tag_regression (__main__.TestDbusService) ... ok
test_vdo_pool_compression_deduplication (__main__.TestDbusService) ... ok
test_vdo_pool_convert (__main__.TestDbusService) ... ok
test_vdo_pool_create (__main__.TestDbusService) ... ok
test_version (__main__.TestDbusService) ... ok
test_vg_activate_deactivate (__main__.TestDbusService) ... ok
test_vg_allocation_policy_set (__main__.TestDbusService) ... ok
test_vg_change (__main__.TestDbusService) ... ok
test_vg_create (__main__.TestDbusService) ... ok
test_vg_delete (__main__.TestDbusService) ... ok
test_vg_extend (__main__.TestDbusService) ... ok
test_vg_max_lv (__main__.TestDbusService) ... ok
test_vg_max_pv (__main__.TestDbusService) ... ok
test_vg_reduce (__main__.TestDbusService) ... ok
test_vg_rename (__main__.TestDbusService) ... ok
test_vg_rename_with_thin_pool (__main__.TestDbusService) ... ok
test_vg_tags (__main__.TestDbusService) ... ok
test_vg_uuid_gen (__main__.TestDbusService) ... ok
test_writecache_lv (__main__.TestDbusService) ... ok

----------------------------------------------------------------------
Ran 68 tests in 185.404s

OK (skipped=1)
Testing TMO=15

Successfully changed execution mode to "lvm shell (non-fork)"
test_cache_lv_create (__main__.TestDbusService) ... ok
test_cache_lv_rename (__main__.TestDbusService)
Make sure that if we rename a cache lv that we correctly handle the ... ok
test_cache_pool_create (__main__.TestDbusService) ... ok
test_external_lv_create (__main__.TestDbusService) ... ok
test_external_pv_create (__main__.TestDbusService) ... ok
test_external_vg_create (__main__.TestDbusService) ... ok
test_invalid_names (__main__.TestDbusService) ... ok
test_invalid_tags (__main__.TestDbusService) ... ok
test_job_handling (__main__.TestDbusService) ... ok
test_job_handling_timer (__main__.TestDbusService) ... ok
test_lookup_by_lvm_id (__main__.TestDbusService) ... ok
test_lv_activate_deactivate (__main__.TestDbusService) ... ok
test_lv_create (__main__.TestDbusService) ... ok
test_lv_create_job (__main__.TestDbusService) ... ok
test_lv_create_linear (__main__.TestDbusService) ... ok
test_lv_create_mirror (__main__.TestDbusService) ... ok
test_lv_create_pv_specific (__main__.TestDbusService) ... ok
test_lv_create_raid (__main__.TestDbusService) ... ok
test_lv_create_rounding (__main__.TestDbusService) ... ok
test_lv_create_striped (__main__.TestDbusService) ... ok
test_lv_create_thin_pool (__main__.TestDbusService) ... ok
test_lv_interface_cache_lv (__main__.TestDbusService) ... ok
test_lv_interface_plain_lv (__main__.TestDbusService) ... ok
test_lv_interface_thin_pool_lv (__main__.TestDbusService) ... ok
test_lv_interface_vdo_lv (__main__.TestDbusService) ... ok
test_lv_interface_vdo_pool_lv (__main__.TestDbusService) ... ok
test_lv_move (__main__.TestDbusService) ... ok
test_lv_on_thin_pool_rename (__main__.TestDbusService) ... ok
test_lv_remove (__main__.TestDbusService) ... ok
test_lv_rename (__main__.TestDbusService) ... ok
test_lv_resize (__main__.TestDbusService) ... ok
test_lv_resize_same (__main__.TestDbusService) ... ok
test_lv_snapshot (__main__.TestDbusService) ... ok
test_lv_tags (__main__.TestDbusService) ... ok
test_lv_thinpool_rename (__main__.TestDbusService) ... ok
test_meta_lv_data_lv_props (__main__.TestDbusService) ... ok
test_move (__main__.TestDbusService) ... ok
test_nesting (__main__.TestDbusService) ... ok
test_prop_get (__main__.TestDbusService) ... ok
test_pv_allocation (__main__.TestDbusService) ... ok
test_pv_remove_add (__main__.TestDbusService) ... ok
test_pv_resize (__main__.TestDbusService) ... ok
test_pv_scan (__main__.TestDbusService) ... skipped 'skipping pv scan test due to known issue'
test_pv_symlinks (__main__.TestDbusService) ... ok
test_pv_tags (__main__.TestDbusService) ... ok
test_refresh (__main__.TestDbusService) ... ok
test_snapshot_merge (__main__.TestDbusService) ... ok
test_snapshot_merge_thin (__main__.TestDbusService) ... ok
test_tag_names (__main__.TestDbusService) ... ok
test_tag_regression (__main__.TestDbusService) ... ok
test_vdo_pool_compression_deduplication (__main__.TestDbusService) ... ok
test_vdo_pool_convert (__main__.TestDbusService) ... ok
test_vdo_pool_create (__main__.TestDbusService) ... ok
test_version (__main__.TestDbusService) ... ok
test_vg_activate_deactivate (__main__.TestDbusService) ... ok
test_vg_allocation_policy_set (__main__.TestDbusService) ... ok
test_vg_change (__main__.TestDbusService) ... ok
test_vg_create (__main__.TestDbusService) ... ok
test_vg_delete (__main__.TestDbusService) ... ok
test_vg_extend (__main__.TestDbusService) ... ok
test_vg_max_lv (__main__.TestDbusService) ... ok
test_vg_max_pv (__main__.TestDbusService) ... ok
test_vg_reduce (__main__.TestDbusService) ... ok
test_vg_rename (__main__.TestDbusService) ... ok
test_vg_rename_with_thin_pool (__main__.TestDbusService) ... ok
test_vg_tags (__main__.TestDbusService) ... ok
test_vg_uuid_gen (__main__.TestDbusService) ... ok
test_writecache_lv (__main__.TestDbusService) ... ok

----------------------------------------------------------------------
Ran 68 tests in 186.173s

OK (skipped=1)

Comment 8 Corey Marthaler 2022-08-04 21:02:48 UTC
Marking this Verified:Tested based on the comment #7.

kernel-5.14.0-138.el9    BUILT: Sun Jul 31 06:20:38 AM CDT 2022
lvm2-2.03.16-3.el9    BUILT: Mon Aug  1 04:42:35 AM CDT 2022
lvm2-libs-2.03.16-3.el9    BUILT: Mon Aug  1 04:42:35 AM CDT 2022
lvm2-dbusd-2.03.16-3.el9    BUILT: Mon Aug  1 04:41:51 AM CDT 2022

Comment 12 errata-xmlrpc 2022-11-15 11:20:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (lvm2 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8358