2 * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
3 * Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
5 * This file is part of LVM2.
7 * This copyrighted material is made available to anyone wishing to use,
8 * modify, copy, or redistribute it subject to the terms and conditions
9 * of the GNU Lesser General Public License v.2.1.
11 * You should have received a copy of the GNU Lesser General Public License
12 * along with this program; if not, write to the Free Software Foundation,
13 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 static int lvchange_permission(struct cmd_context
*cmd
,
19 struct logical_volume
*lv
)
25 lv_access
= arg_uint_value(cmd
, permission_ARG
, 0);
27 if ((lv_access
& LVM_WRITE
) && (lv
->status
& LVM_WRITE
)) {
28 log_error("Logical volume \"%s\" is already writable",
33 if (!(lv_access
& LVM_WRITE
) && !(lv
->status
& LVM_WRITE
)) {
34 log_error("Logical volume \"%s\" is already read only",
39 if ((lv
->status
& MIRRORED
) && (vg_is_clustered(lv
->vg
)) &&
40 lv_info(cmd
, lv
, 0, &info
, 0, 0) && info
.exists
) {
41 log_error("Cannot change permissions of mirror \"%s\" "
42 "while active.", lv
->name
);
46 /* Not allowed to change permissions on RAID sub-LVs directly */
47 if ((lv
->status
& RAID_META
) || (lv
->status
& RAID_IMAGE
)) {
48 log_error("Cannot change permissions of RAID %s \"%s\"",
49 (lv
->status
& RAID_IMAGE
) ? "image" :
50 "metadata area", lv
->name
);
54 if (lv_access
& LVM_WRITE
) {
55 lv
->status
|= LVM_WRITE
;
56 log_verbose("Setting logical volume \"%s\" read/write",
59 lv
->status
&= ~LVM_WRITE
;
60 log_verbose("Setting logical volume \"%s\" read-only",
64 log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv
->name
);
65 if (!vg_write(lv
->vg
))
68 if (!suspend_lv(cmd
, lv
)) {
69 log_error("Failed to lock %s", lv
->name
);
74 if (!vg_commit(lv
->vg
)) {
75 if (!resume_lv(cmd
, lv
))
80 log_very_verbose("Updating permissions for \"%s\" in kernel", lv
->name
);
81 if (!resume_lv(cmd
, lv
)) {
82 log_error("Problem reactivating %s", lv
->name
);
92 static int lvchange_pool_update(struct cmd_context
*cmd
,
93 struct logical_volume
*lv
)
98 thin_discard_t discard
;
100 if (!lv_is_thin_pool(lv
)) {
101 log_error("Logical volume \"%s\" is not a thinpool.", lv
->name
);
105 if (arg_count(cmd
, discard_ARG
)) {
106 discard
= arg_uint_value(cmd
, discard_ARG
, 0);
107 if (discard
!= first_seg(lv
)->discard
) {
108 if (((discard
== THIN_DISCARD_IGNORE
) ||
109 (first_seg(lv
)->discard
== THIN_DISCARD_IGNORE
)) &&
111 log_error("Cannot change discard state for active "
112 "logical volume \"%s\".", lv
->name
);
114 first_seg(lv
)->discard
= discard
;
118 log_error("Logical volume \"%s\" already uses discard %s.",
119 lv
->name
, get_pool_discard_name(discard
));
122 if (arg_count(cmd
, zero_ARG
)) {
123 val
= arg_uint_value(cmd
, zero_ARG
, 1);
124 if (val
!= first_seg(lv
)->zero_new_blocks
) {
125 first_seg(lv
)->zero_new_blocks
= val
;
128 log_error("Logical volume \"%s\" already %szero new blocks.",
129 lv
->name
, val
? "" : "does not ");
135 log_very_verbose("Updating logical volume \"%s\" on disk(s).", lv
->name
);
136 if (!vg_write(lv
->vg
))
139 if (!suspend_lv_origin(cmd
, lv
)) {
140 log_error("Failed to update active %s/%s (deactivation is needed).",
141 lv
->vg
->name
, lv
->name
);
146 if (!vg_commit(lv
->vg
)) {
147 if (!resume_lv_origin(cmd
, lv
))
152 if (!resume_lv_origin(cmd
, lv
)) {
153 log_error("Problem reactivating %s.", lv
->name
);
163 static int lvchange_monitoring(struct cmd_context
*cmd
,
164 struct logical_volume
*lv
)
168 if (!lv_info(cmd
, lv
, lv_is_thin_pool(lv
) ? 1 : 0,
169 &info
, 0, 0) || !info
.exists
) {
170 log_error("Logical volume, %s, is not active", lv
->name
);
174 /* do not monitor pvmove lv's */
175 if (lv
->status
& PVMOVE
)
178 if ((dmeventd_monitor_mode() != DMEVENTD_MONITOR_IGNORE
) &&
179 !monitor_dev_for_events(cmd
, lv
, 0, dmeventd_monitor_mode()))
185 static int lvchange_background_polling(struct cmd_context
*cmd
,
186 struct logical_volume
*lv
)
190 if (!lv_info(cmd
, lv
, 0, &info
, 0, 0) || !info
.exists
) {
191 log_error("Logical volume, %s, is not active", lv
->name
);
195 if (background_polling())
196 lv_spawn_background_polling(cmd
, lv
);
201 static int _lvchange_activate(struct cmd_context
*cmd
, struct logical_volume
*lv
)
205 activate
= arg_uint_value(cmd
, activate_ARG
, 0);
207 if (lv_is_cow(lv
) && !lv_is_virtual_origin(origin_from_cow(lv
)))
208 lv
= origin_from_cow(lv
);
210 if (activate
== CHANGE_AAY
) {
211 if (!lv_passes_auto_activation_filter(cmd
, lv
))
213 activate
= CHANGE_ALY
;
216 if (activate
== CHANGE_ALN
) {
217 log_verbose("Deactivating logical volume \"%s\" locally",
219 if (!deactivate_lv_local(cmd
, lv
))
221 } else if (activate
== CHANGE_AN
) {
222 log_verbose("Deactivating logical volume \"%s\"", lv
->name
);
223 if (!deactivate_lv(cmd
, lv
))
226 if ((activate
== CHANGE_AE
) ||
228 lv_is_thin_type(lv
)) {
229 log_verbose("Activating logical volume \"%s\" "
230 "exclusively", lv
->name
);
231 if (!activate_lv_excl(cmd
, lv
))
233 } else if (activate
== CHANGE_ALY
) {
234 log_verbose("Activating logical volume \"%s\" locally",
236 if (!activate_lv_local(cmd
, lv
))
239 log_verbose("Activating logical volume \"%s\"",
241 if (!activate_lv(cmd
, lv
))
245 if (background_polling())
246 lv_spawn_background_polling(cmd
, lv
);
252 static int lvchange_refresh(struct cmd_context
*cmd
, struct logical_volume
*lv
)
254 log_verbose("Refreshing logical volume \"%s\" (if active)", lv
->name
);
256 return lv_refresh(cmd
, lv
);
259 static int lvchange_resync(struct cmd_context
*cmd
,
260 struct logical_volume
*lv
)
265 struct logical_volume
*log_lv
;
267 if (!(lv
->status
& MIRRORED
)) {
268 log_error("Unable to resync %s because it is not mirrored.",
273 if (lv
->status
& PVMOVE
) {
274 log_error("Unable to resync pvmove volume %s", lv
->name
);
278 if (lv
->status
& LOCKED
) {
279 log_error("Unable to resync locked volume %s", lv
->name
);
283 if (lv_info(cmd
, lv
, 0, &info
, 1, 0)) {
284 if (info
.open_count
) {
285 log_error("Can't resync open logical volume \"%s\"",
291 if (!arg_count(cmd
, yes_ARG
) &&
292 yes_no_prompt("Do you really want to deactivate "
293 "logical volume %s to resync it? [y/n]: ",
295 log_error("Logical volume \"%s\" not resynced",
307 /* Activate exclusively to ensure no nodes still have LV active */
308 monitored
= dmeventd_monitor_mode();
309 init_dmeventd_monitor(0);
311 if (!deactivate_lv(cmd
, lv
)) {
312 log_error("Unable to deactivate %s for resync", lv
->name
);
316 if (vg_is_clustered(lv
->vg
) && lv_is_active(lv
)) {
317 log_error("Can't get exclusive access to clustered volume %s",
322 init_dmeventd_monitor(monitored
);
324 log_lv
= first_seg(lv
)->log_lv
;
326 log_very_verbose("Starting resync of %s%s%s mirror \"%s\"",
327 (active
) ? "active " : "",
328 vg_is_clustered(lv
->vg
) ? "clustered " : "",
329 (log_lv
) ? "disk-logged" : "core-logged",
333 * If this mirror has a core log (i.e. !log_lv),
334 * then simply deactivating/activating will cause
335 * it to reset the sync status. We only need to
336 * worry about persistent logs.
338 if (!log_lv
&& !(lv
->status
& LV_NOTSYNCED
)) {
339 if (active
&& !activate_lv(cmd
, lv
)) {
340 log_error("Failed to reactivate %s to resynchronize "
347 lv
->status
&= ~LV_NOTSYNCED
;
350 /* Separate mirror log so we can clear it */
351 detach_mirror_log(first_seg(lv
));
353 if (!vg_write(lv
->vg
)) {
354 log_error("Failed to write intermediate VG metadata.");
355 if (!attach_mirror_log(first_seg(lv
), log_lv
))
357 if (active
&& !activate_lv(cmd
, lv
))
362 if (!vg_commit(lv
->vg
)) {
363 log_error("Failed to commit intermediate VG metadata.");
364 if (!attach_mirror_log(first_seg(lv
), log_lv
))
366 if (active
&& !activate_lv(cmd
, lv
))
373 if (!activate_lv(cmd
, log_lv
)) {
374 log_error("Unable to activate %s for mirror log resync",
379 log_very_verbose("Clearing log device %s", log_lv
->name
);
380 if (!set_lv(cmd
, log_lv
, log_lv
->size
, 0)) {
381 log_error("Unable to reset sync status for %s", lv
->name
);
382 if (!deactivate_lv(cmd
, log_lv
))
383 log_error("Failed to deactivate log LV after "
388 if (!deactivate_lv(cmd
, log_lv
)) {
389 log_error("Unable to deactivate log LV %s after wiping "
390 "for resync", log_lv
->name
);
394 /* Put mirror log back in place */
395 if (!attach_mirror_log(first_seg(lv
), log_lv
))
399 log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv
->name
);
400 if (!vg_write(lv
->vg
) || !vg_commit(lv
->vg
)) {
401 log_error("Failed to update metadata on disk.");
405 if (active
&& !activate_lv(cmd
, lv
)) {
406 log_error("Failed to reactivate %s after resync", lv
->name
);
413 static int lvchange_alloc(struct cmd_context
*cmd
, struct logical_volume
*lv
)
415 int want_contiguous
= 0;
416 alloc_policy_t alloc
;
418 want_contiguous
= strcmp(arg_str_value(cmd
, contiguous_ARG
, "n"), "n");
419 alloc
= want_contiguous
? ALLOC_CONTIGUOUS
: ALLOC_INHERIT
;
420 alloc
= (alloc_policy_t
) arg_uint_value(cmd
, alloc_ARG
, alloc
);
422 if (alloc
== lv
->alloc
) {
423 log_error("Allocation policy of logical volume \"%s\" is "
424 "already %s", lv
->name
, get_alloc_string(alloc
));
430 /* FIXME If contiguous, check existing extents already are */
432 log_verbose("Setting contiguous allocation policy for \"%s\" to %s",
433 lv
->name
, get_alloc_string(alloc
));
435 log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv
->name
);
437 /* No need to suspend LV for this change */
438 if (!vg_write(lv
->vg
) || !vg_commit(lv
->vg
))
446 static int lvchange_readahead(struct cmd_context
*cmd
,
447 struct logical_volume
*lv
)
449 unsigned read_ahead
= 0;
450 unsigned pagesize
= (unsigned) lvm_getpagesize() >> SECTOR_SHIFT
;
453 read_ahead
= arg_uint_value(cmd
, readahead_ARG
, 0);
455 if (read_ahead
!= DM_READ_AHEAD_AUTO
&&
456 (lv
->vg
->fid
->fmt
->features
& FMT_RESTRICTED_READAHEAD
) &&
457 (read_ahead
< 2 || read_ahead
> 120)) {
458 log_error("Metadata only supports readahead values between 2 and 120.");
462 if (read_ahead
!= DM_READ_AHEAD_AUTO
&&
463 read_ahead
!= DM_READ_AHEAD_NONE
&& read_ahead
% pagesize
) {
464 if (read_ahead
< pagesize
)
465 read_ahead
= pagesize
;
467 read_ahead
= (read_ahead
/ pagesize
) * pagesize
;
468 log_warn("WARNING: Overriding readahead to %u sectors, a multiple "
469 "of %uK page size.", read_ahead
, pagesize
>> 1);
472 if (lv
->read_ahead
== read_ahead
) {
473 if (read_ahead
== DM_READ_AHEAD_AUTO
)
474 log_error("Read ahead is already auto for \"%s\"", lv
->name
);
476 log_error("Read ahead is already %u for \"%s\"",
477 read_ahead
, lv
->name
);
481 lv
->read_ahead
= read_ahead
;
483 log_verbose("Setting read ahead to %u for \"%s\"", read_ahead
,
486 log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv
->name
);
487 if (!vg_write(lv
->vg
))
490 if (!suspend_lv(cmd
, lv
)) {
491 log_error("Failed to lock %s", lv
->name
);
496 if (!vg_commit(lv
->vg
)) {
497 if (!resume_lv(cmd
, lv
))
502 log_very_verbose("Updating permissions for \"%s\" in kernel", lv
->name
);
503 if (!resume_lv(cmd
, lv
)) {
504 log_error("Problem reactivating %s", lv
->name
);
514 static int lvchange_persistent(struct cmd_context
*cmd
,
515 struct logical_volume
*lv
)
519 int32_t major
, minor
;
521 if (!strcmp(arg_str_value(cmd
, persistent_ARG
, "n"), "n")) {
522 if (!(lv
->status
& FIXED_MINOR
)) {
523 log_error("Minor number is already not persistent "
524 "for \"%s\"", lv
->name
);
527 lv
->status
&= ~FIXED_MINOR
;
530 log_verbose("Disabling persistent device number for \"%s\"",
533 if (!arg_count(cmd
, minor_ARG
) && lv
->minor
< 0) {
534 log_error("Minor number must be specified with -My");
537 if (arg_count(cmd
, major_ARG
) > 1) {
538 log_error("Option -j/--major may not be repeated.");
541 if (arg_count(cmd
, minor_ARG
) > 1) {
542 log_error("Option --minor may not be repeated.");
545 if (!arg_count(cmd
, major_ARG
) && lv
->major
< 0) {
546 log_error("Major number must be specified with -My");
549 if (lv_info(cmd
, lv
, 0, &info
, 0, 0) && info
.exists
)
552 major
= arg_int_value(cmd
, major_ARG
, lv
->major
);
553 minor
= arg_int_value(cmd
, minor_ARG
, lv
->minor
);
554 if (!major_minor_valid(cmd
, lv
->vg
->fid
->fmt
, major
, minor
))
557 if (active
&& !arg_count(cmd
, force_ARG
) &&
558 yes_no_prompt("Logical volume %s will be "
559 "deactivated temporarily. "
560 "Continue? [y/n]: ", lv
->name
) == 'n') {
561 log_error("%s device number not changed.",
569 log_verbose("Ensuring %s is inactive.", lv
->name
);
570 if (!deactivate_lv(cmd
, lv
)) {
571 log_error("%s: deactivation failed", lv
->name
);
574 lv
->status
|= FIXED_MINOR
;
577 log_verbose("Setting persistent device number to (%d, %d) "
578 "for \"%s\"", lv
->major
, lv
->minor
, lv
->name
);
582 log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv
->name
);
583 if (!vg_write(lv
->vg
) || !vg_commit(lv
->vg
))
589 log_verbose("Re-activating logical volume \"%s\"", lv
->name
);
590 if (!activate_lv(cmd
, lv
)) {
591 log_error("%s: reactivation failed", lv
->name
);
599 static int lvchange_tag(struct cmd_context
*cmd
, struct logical_volume
*lv
, int arg
)
601 if (!change_tag(cmd
, NULL
, lv
, NULL
, arg
))
604 log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv
->name
);
606 /* No need to suspend LV for this change */
607 if (!vg_write(lv
->vg
) || !vg_commit(lv
->vg
))
615 static int lvchange_single(struct cmd_context
*cmd
, struct logical_volume
*lv
,
616 void *handle
__attribute__((unused
)))
618 int doit
= 0, docmds
= 0;
620 struct logical_volume
*origin
;
623 if (!(lv
->vg
->status
& LVM_WRITE
) &&
624 (arg_count(cmd
, contiguous_ARG
) || arg_count(cmd
, permission_ARG
) ||
625 arg_count(cmd
, readahead_ARG
) || arg_count(cmd
, persistent_ARG
) ||
626 arg_count(cmd
, discard_ARG
) ||
627 arg_count(cmd
, zero_ARG
) ||
628 arg_count(cmd
, alloc_ARG
))) {
629 log_error("Only -a permitted with read-only volume "
630 "group \"%s\"", lv
->vg
->name
);
631 return EINVALID_CMD_LINE
;
634 if (lv_is_origin(lv
) &&
635 (arg_count(cmd
, contiguous_ARG
) || arg_count(cmd
, permission_ARG
) ||
636 arg_count(cmd
, readahead_ARG
) || arg_count(cmd
, persistent_ARG
) ||
637 arg_count(cmd
, alloc_ARG
))) {
638 log_error("Can't change logical volume \"%s\" under snapshot",
643 if (lv_is_cow(lv
) && !lv_is_virtual_origin(origin
= origin_from_cow(lv
)) &&
644 arg_count(cmd
, activate_ARG
)) {
645 if (origin
->origin_count
< 2)
647 else if (dm_snprintf(snaps_msg
, sizeof(snaps_msg
),
648 " and %u other snapshot(s)",
649 origin
->origin_count
- 1) < 0) {
650 log_error("Failed to prepare message.");
654 if (!arg_count(cmd
, yes_ARG
) &&
655 (yes_no_prompt("Change of snapshot %s will also change its"
656 " origin %s%s. Proceed? [y/n]: ", lv
->name
,
657 origin
->name
, snaps_msg
) == 'n')) {
658 log_error("Logical volume %s not changed.", lv
->name
);
663 if (lv
->status
& PVMOVE
) {
664 log_error("Unable to change pvmove LV %s", lv
->name
);
665 if (arg_count(cmd
, activate_ARG
))
666 log_error("Use 'pvmove --abort' to abandon a pvmove");
670 if (lv
->status
& MIRROR_LOG
) {
671 log_error("Unable to change mirror log LV %s directly", lv
->name
);
675 if (lv
->status
& MIRROR_IMAGE
) {
676 log_error("Unable to change mirror image LV %s directly",
681 /* If LV is sparse, activate origin instead */
682 if (arg_count(cmd
, activate_ARG
) && lv_is_cow(lv
) &&
683 lv_is_virtual_origin(origin
= origin_from_cow(lv
)))
686 if (!(lv_is_visible(lv
)) && !lv_is_virtual_origin(lv
)) {
687 log_error("Unable to change internal LV %s directly",
693 * FIXME: DEFAULT_BACKGROUND_POLLING should be "unspecified".
694 * If --poll is explicitly provided use it; otherwise polling
695 * should only be started if the LV is not already active. So:
696 * 1) change the activation code to say if the LV was actually activated
697 * 2) make polling of an LV tightly coupled with LV activation
699 * Do not initiate any polling if --sysinit option is used.
701 init_background_polling(arg_count(cmd
, sysinit_ARG
) ? 0 :
702 arg_int_value(cmd
, poll_ARG
,
703 DEFAULT_BACKGROUND_POLLING
));
705 /* access permission change */
706 if (arg_count(cmd
, permission_ARG
)) {
707 if (!archive(lv
->vg
)) {
712 doit
+= lvchange_permission(cmd
, lv
);
716 /* allocation policy change */
717 if (arg_count(cmd
, contiguous_ARG
) || arg_count(cmd
, alloc_ARG
)) {
718 if (!archived
&& !archive(lv
->vg
)) {
723 doit
+= lvchange_alloc(cmd
, lv
);
727 /* read ahead sector change */
728 if (arg_count(cmd
, readahead_ARG
)) {
729 if (!archived
&& !archive(lv
->vg
)) {
734 doit
+= lvchange_readahead(cmd
, lv
);
738 /* persistent device number change */
739 if (arg_count(cmd
, persistent_ARG
)) {
740 if (!archived
&& !archive(lv
->vg
)) {
745 doit
+= lvchange_persistent(cmd
, lv
);
747 if (sigint_caught()) {
753 if (arg_count(cmd
, discard_ARG
) ||
754 arg_count(cmd
, zero_ARG
)) {
755 if (!archived
&& !archive(lv
->vg
)) {
760 doit
+= lvchange_pool_update(cmd
, lv
);
765 if (arg_count(cmd
, addtag_ARG
)) {
766 if (!archived
&& !archive(lv
->vg
)) {
771 doit
+= lvchange_tag(cmd
, lv
, addtag_ARG
);
776 if (arg_count(cmd
, deltag_ARG
)) {
777 if (!archived
&& !archive(lv
->vg
)) {
782 doit
+= lvchange_tag(cmd
, lv
, deltag_ARG
);
787 log_print("Logical volume \"%s\" changed", lv
->name
);
789 if (arg_count(cmd
, resync_ARG
))
790 if (!lvchange_resync(cmd
, lv
)) {
795 /* activation change */
796 if (arg_count(cmd
, activate_ARG
)) {
797 if (!_lvchange_activate(cmd
, lv
)) {
803 if (arg_count(cmd
, refresh_ARG
))
804 if (!lvchange_refresh(cmd
, lv
)) {
809 if (!arg_count(cmd
, activate_ARG
) &&
810 !arg_count(cmd
, refresh_ARG
) &&
811 arg_count(cmd
, monitor_ARG
)) {
812 if (!lvchange_monitoring(cmd
, lv
)) {
818 if (!arg_count(cmd
, activate_ARG
) &&
819 !arg_count(cmd
, refresh_ARG
) &&
820 arg_count(cmd
, poll_ARG
)) {
821 if (!lvchange_background_polling(cmd
, lv
)) {
827 if (doit
!= docmds
) {
832 return ECMD_PROCESSED
;
835 int lvchange(struct cmd_context
*cmd
, int argc
, char **argv
)
837 int update
= /* options other than -a, --refresh, --monitor or --poll */
838 arg_count(cmd
, contiguous_ARG
) || arg_count(cmd
, permission_ARG
) ||
839 arg_count(cmd
, readahead_ARG
) || arg_count(cmd
, persistent_ARG
) ||
840 arg_count(cmd
, addtag_ARG
) || arg_count(cmd
, deltag_ARG
) ||
841 arg_count(cmd
, resync_ARG
) || arg_count(cmd
, alloc_ARG
) ||
842 arg_count(cmd
, discard_ARG
) ||
843 arg_count(cmd
, zero_ARG
);
846 !arg_count(cmd
, activate_ARG
) && !arg_count(cmd
, refresh_ARG
) &&
847 !arg_count(cmd
, monitor_ARG
) && !arg_count(cmd
, poll_ARG
)) {
848 log_error("Need 1 or more of -a, -C, -M, -p, -r, "
849 "--resync, --refresh, --alloc, --addtag, --deltag, "
850 "--monitor or --poll");
851 return EINVALID_CMD_LINE
;
854 if (arg_count(cmd
, activate_ARG
) && arg_count(cmd
, refresh_ARG
)) {
855 log_error("Only one of -a and --refresh permitted.");
856 return EINVALID_CMD_LINE
;
859 if ((arg_count(cmd
, ignorelockingfailure_ARG
) ||
860 arg_count(cmd
, sysinit_ARG
)) && update
) {
861 log_error("Only -a permitted with --ignorelockingfailure and --sysinit");
862 return EINVALID_CMD_LINE
;
866 cmd
->handles_missing_pvs
= 1;
869 log_error("Please give logical volume path(s)");
870 return EINVALID_CMD_LINE
;
873 if ((arg_count(cmd
, minor_ARG
) || arg_count(cmd
, major_ARG
)) &&
874 !arg_count(cmd
, persistent_ARG
)) {
875 log_error("--major and --minor require -My");
876 return EINVALID_CMD_LINE
;
879 if (arg_count(cmd
, minor_ARG
) && argc
!= 1) {
880 log_error("Only give one logical volume when specifying minor");
881 return EINVALID_CMD_LINE
;
884 if (arg_count(cmd
, contiguous_ARG
) && arg_count(cmd
, alloc_ARG
)) {
885 log_error("Only one of --alloc and --contiguous permitted");
886 return EINVALID_CMD_LINE
;
889 if (arg_count(cmd
, poll_ARG
) && arg_count(cmd
, sysinit_ARG
)) {
890 log_error("Only one of --poll and --sysinit permitted");
891 return EINVALID_CMD_LINE
;
894 if (arg_count(cmd
, sysinit_ARG
) && lvmetad_active() &&
895 arg_uint_value(cmd
, activate_ARG
, 0) == CHANGE_AAY
) {
896 log_warn("lvmetad is active while using --sysinit -a ay, "
897 "skipping manual activation");
898 return ECMD_PROCESSED
;
901 return process_each_lv(cmd
, argc
, argv
,
902 update
? READ_FOR_UPDATE
: 0, NULL
,