Description of problem: I have 200 LVs and accidently tried to remove them without the "-f" flag. This results in a prompt for every LV and I just have the time to type "y" 200 times. Other cmds capture signals when prompting, so lvm should as well. [root@link-08 tmp]# ls [tab] Display all 161 possibilities? (y or n) [Ctrl-C] [root@link-08 tmp]# [root@link-08 bin]# lvremove /dev/corey* Do you really want to remove active logical volume "vol0"? [y/n]: y [Ctrl-C]
Yeah - not sure how easy it'll be to do this though because of the way the code is structured. [Blocked ctrl-c means a lock is held on the VG; so we have to release that lock while asking the question - then get the lock again and go back to square one and revalidate everything. Alternatively have to find a way to decouple ctrl-c and the locking safely.]
This bugzilla had previously been approved for engineering consideration but Red Hat Product Management is currently reevaluating this issue for inclusion in RHEL4.6.
Suggest investigating the 2nd option first: yes_no_prompt() calls new function in locking.c that installs a ctrl-c handler iff _signals_blocked, and if triggered, yes_no_prompt() returns \0 for caller to check for and abort.
(c.f. existing ctrl-c handler code in file_locking.c used when waiting for a lock)
Created attachment 155274 [details] lvm2-prompt-sigint.diff A slightly different approach, where yes_no_prompt itself reacts to the signal. I think yes_no_prompt should not be called in the middle of "critical" region of code, so it should be safe this way (need to verify and document that yes_no_prompt is a point of possible interruption, i suppose). It should however be easy to lift the sigint_allow/sigint_check_exit/sigint_restore calls into callers of yes_no_prompt, either way. (Looking at the patch, sigint_check_exit() call could be added to sigint_restore(), although i'm not sure how good idea that is. Just a sidenote.)
fix verified in lvm2-2.02.27-1.el4.
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 the 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-2007-0753.html