public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: agk@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW lib/activate/activate.c Date: Tue, 29 Sep 2009 18:50:00 -0000 [thread overview] Message-ID: <20090929185029.28852.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@sourceware.org 2009-09-29 18:50:29 Modified files: . : WHATS_NEW lib/activate : activate.c Log message: Don't attempt to deactivate an LV if any of its snapshots are in use. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1278&r2=1.1279 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/activate.c.diff?cvsroot=lvm2&r1=1.154&r2=1.155 --- LVM2/WHATS_NEW 2009/09/29 15:17:54 1.1278 +++ LVM2/WHATS_NEW 2009/09/29 18:50:28 1.1279 @@ -1,5 +1,6 @@ Version 2.02.54 - ===================================== + Don't attempt to deactivate an LV if any of its snapshots are in use. Return fail if lv_deactivate fails to remove device from kernel. Provide alternative implementation of obsolete siginterrupt(). Consolidate LV allocation into alloc_lv(). --- LVM2/lib/activate/activate.c 2009/09/29 15:17:54 1.154 +++ LVM2/lib/activate/activate.c 2009/09/29 18:50:28 1.155 @@ -975,6 +975,29 @@ return _lv_resume(cmd, lvid_s, 1); } +static int _lv_has_open_snapshots(struct logical_volume *lv) +{ + struct lv_segment *snap_seg; + struct lvinfo info; + int r = 0; + + dm_list_iterate_items_gen(snap_seg, &lv->snapshot_segs, origin_list) { + if (!lv_info(lv->vg->cmd, snap_seg->cow, &info, 1, 0)) { + r = 1; + continue; + } + + if (info.exists && info.open_count) { + log_error("LV %s/%s has open snapshot %s: " + "not deactivating", lv->vg->name, lv->name, + snap_seg->cow->name); + r = 1; + } + } + + return r; +} + int lv_deactivate(struct cmd_context *cmd, const char *lvid_s) { struct logical_volume *lv; @@ -1001,10 +1024,14 @@ goto out; } - if (info.open_count && lv_is_visible(lv)) { - log_error("LV %s/%s in use: not deactivating", lv->vg->name, - lv->name); - goto out; + if (lv_is_visible(lv)) { + if (info.open_count) { + log_error("LV %s/%s in use: not deactivating", + lv->vg->name, lv->name); + goto out; + } + if (lv_is_origin(lv) && _lv_has_open_snapshots(lv)) + goto_out; } lv_calculate_readahead(lv, NULL);
next reply other threads:[~2009-09-29 18:50 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-09-29 18:50 agk [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-01-25 22:16 zkabelac 2011-02-18 14:26 zkabelac 2010-08-16 23:29 agk 2010-07-12 11:37 prajnoha 2010-05-21 14:34 zkabelac 2010-01-27 13:24 mbroz 2009-12-03 19:23 mbroz 2009-12-01 19:10 mbroz 2009-10-30 13:07 agk 2009-09-29 15:17 mbroz 2007-08-01 20:29 jbrassow 2006-12-20 16:19 agk 2005-12-22 16:13 agk 2004-05-11 17:09 agk
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090929185029.28852.qmail@sourceware.org \ --to=agk@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).