summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-06-11 18:35:01 -0700
committerSage Weil <sage@inktank.com>2013-06-14 14:09:24 -0700
commit062b9296c98a03f4f291615dce010aebc55aaa32 (patch)
treee74b8af955aea38835135af0eb2fb962bcac7f0d
parent9f9dc8b85a81529deb6865ec5f1cebb45f04ddc4 (diff)
downloadceph-062b9296c98a03f4f291615dce010aebc55aaa32.tar.gz
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 <sage@inktank.com> (cherry picked from commit 8b3b59e01432090f7ae774e971862316203ade68)
-rwxr-xr-xsrc/ceph-disk44
1 files changed, 13 insertions, 31 deletions
diff --git a/src/ceph-disk b/src/ceph-disk
index 02aaa5e9986..60498b4acc6 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)