From: Sage Weil Date: Wed, 12 Jun 2013 01:35:01 +0000 (-0700) Subject: ceph-disk: call partprobe outside of the prepare lock; drop udevadm settle X-Git-Tag: v0.65~74^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8b3b59e01432090f7ae774e971862316203ade68;p=ceph.git ceph-disk: call partprobe outside of the prepare lock; drop udevadm settle After we change the final partition type, sgdisk may or may not trigger a udev event, depending on how well udev is behaving (it varies between distros, it seems). The old code would often settle and wait for udev to activate the device, and then partprobe would uselessly fail because it was already mounted. Call partprobe only at the very end, after prepare is done. This ensures that if partprobe calls udevadm settle (which is sometimes does) we do not get stuck. Drop the udevadm settle. I'm not sure what this accomplishes; take it out, at least until we determine we need it. Signed-off-by: Sage Weil --- diff --git a/src/ceph-disk b/src/ceph-disk index 6ee15da736b..d5642c58a92 100755 --- a/src/ceph-disk +++ b/src/ceph-disk @@ -761,14 +761,6 @@ def prepare_journal_dev( # wait for udev event queue to clear 'udevadm', 'settle', - '--timeout=10', - ], - ) - subprocess.check_call( - args=[ - # also make sure the kernel refreshes the new table - 'partprobe', - journal, ], ) @@ -963,14 +955,6 @@ def prepare_dev( # wait for udev event queue to clear 'udevadm', 'settle', - '--timeout=10', - ], - ) - subprocess.check_call( - args=[ - # also make sure the kernel refreshes the new table - 'partprobe', - data, ], ) except subprocess.CalledProcessError as e: @@ -1037,21 +1021,6 @@ def prepare_dev( data, ], ) - subprocess.call( - args=[ - # wait for udev event queue to clear - 'udevadm', - 'settle', - '--timeout=10', - ], - ) - subprocess.check_call( - args=[ - # also make sure the kernel refreshes the new table - 'partprobe', - data, - ], - ) except subprocess.CalledProcessError as e: raise Error(e) @@ -1192,6 +1161,19 @@ def main_prepare(args): raise Error('not a dir or block device', args.data) prepare_lock.release() + if stat.S_ISBLK(dmode): + # try to make sure the kernel refreshes the table. note + # that if this gets ebusy, we are probably racing with + # udev because it already updated it.. ignore failure here. + LOG.debug('Calling partprobe on prepared device %s', args.data) + subprocess.call( + args=[ + 'partprobe', + args.data, + ], + ) + + except Error as e: if journal_dm_keypath: os.unlink(journal_dm_keypath)