All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Uzel <petr.uzel@suse.cz>
To: Christophe Varoqui <christophe.varoqui@free.fr>
Cc: dm-devel@redhat.com
Subject: [multipath-tools] kpartx: DELETE logic question
Date: Tue, 16 Jun 2009 14:44:49 +0200	[thread overview]
Message-ID: <20090616124449.GA12404@localhost> (raw)

Hi all,

In current multipath-tools, the deletion of devmappings is
done by following code snippet:

405  case DELETE:
406  for (j = n-1; j >= 0; j--) {
407    if (safe_sprintf(partname, "%s%s%d",
408             mapname, delim, j+1)) {
409       fprintf(stderr, "partname too small\n");
410       exit(1);
411    }
412    strip_slash(partname);
413  
414    if (!slices[j].size || !dm_map_present(partname))
415        continue;
416  
417    if (!dm_simplecmd(DM_DEVICE_REMOVE,
418                partname, 0)) {
419      r++;
420      continue;
421     }
422     if (verbose)
423     printf("del devmap : %s\n", partname);
424   }


I wonder what's the logic behind the test on line 414. The second part
(testing whether the mapping exists) is obvious. But what about the
first part? Why don't we want to delete mapping for partition with
size==0, i.e. partition that no longer exists in the partition table?

Suppose following scenario:
- create 3 primary partitions on dm-0
- run kpartx -a /dev/dm-0
- delete partition #2
- run kpartx -d /dev/dm-0

The result is that mapping for partition #2 is not deleted - is this
what is expected?


Thanks,


-- 
Best regards / s pozdravem

Petr Uzel, Packages maintainer
---------------------------------------------------------------------
SUSE LINUX, s.r.o.                          e-mail: puzel@suse.cz
Lihovarská 1060/12                          http://www.suse.cz
190 00 Prague 9                             
Czech Republic                              

                 reply	other threads:[~2009-06-16 12:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090616124449.GA12404@localhost \
    --to=petr.uzel@suse.cz \
    --cc=christophe.varoqui@free.fr \
    --cc=dm-devel@redhat.com \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.