[parted-devel] [PATCH 1/6] libparted: refactor device-mapper partition sync code

Jim Meyering jim at meyering.net
Wed Oct 17 17:26:41 UTC 2012


Phillip Susi wrote:
> The device-mapper partition sync code was still using the remove all
> partitions, then add new partitions method.  Refactor to use the same
> algorithm as regular disks: try to remove all, and ignore any that could
> not be removed but have not changed.
> ---
>  NEWS                   |    2 +
>  libparted/arch/linux.c |  403 +++++++++++++++++++++---------------------------
>  tests/Makefile.am      |    1 +
>  tests/t6002-dm-busy.sh |   94 +++++++++++
>  4 files changed, 275 insertions(+), 225 deletions(-)
>  create mode 100644 tests/t6002-dm-busy.sh
>
> diff --git a/NEWS b/NEWS
> index 4c4716d..f182cce 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -3,6 +3,8 @@ GNU parted NEWS                                    -*- outline -*-
>  * Noteworthy changes in release ?.? (????-??-??) [?]
>
>  ** Bug Fixes
> +  libparted: Don't fail to manipulate partitions on dmraid disks that
> +  have other partitions in use.

Hi Phillip,

Rats.
I've finally run your new test, and it fails on Fedora 17.
It fails because the .../dev/mapper/plinear-1675p? devices never appear.
i.e.

I ran this:

  sudo make check -C tests TESTS=t6002-dm-busy.sh VERBOSE=yes

and found this in the log:

  + printf '%s\n' 'diff -u /dev/null out' '--- /dev/null  1970-01-01' '+++ out    1
  970-01-01'
  diff -u /dev/null out
  --- /dev/null   1970-01-01
  +++ out 1970-01-01
  + sed 's/^/+/' out
  +device-mapper: create ioctl on plinear-9049p1 failed: Device or resource busy
  +Error: Failed to add partition 1 (No such device or address)
  + return 1
  + case $? in
  + return 1
  + fail=1
  + wait_for_dev_to_appear_ /dev/mapper/plinear-9049p2
  ...
  + ls /dev/mapper/plinear-9049p2
  + sleep .1
  ++ expr 19 + 1
  + i=20
  + test 20 = 20
  + break
  + return 1
  + fail_ /dev/mapper/plinear-9049p2 did not appear
  + warn_ 't6002-dm-busy.sh: failed test: /dev/mapper/plinear-9049p2' did not appear
  + case $IFS in
  + printf '%s\n' 't6002-dm-busy.sh: failed test: /dev/mapper/plinear-9049p2 did not appear'
  t6002-dm-busy.sh: failed test: /dev/mapper/plinear-9049p2 did not appear

FYI, I'm using this kernel: 3.5.2-3.fc17.x86_64

That's both with and without the changes I've made.
Any idea what's wrong?



More information about the parted-devel mailing list