[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [multipath-tools] kpartx: DELETE logic question



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                              


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]