From patchwork Tue Jan 29 04:20:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Doan X-Patchwork-Id: 14319 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 99E3923F91 for ; Tue, 29 Jan 2013 04:20:22 +0000 (UTC) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by fiordland.canonical.com (Postfix) with ESMTP id 3DF79A19612 for ; Tue, 29 Jan 2013 04:20:22 +0000 (UTC) Received: by mail-vc0-f177.google.com with SMTP id m18so11089vcm.8 for ; Mon, 28 Jan 2013 20:20:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:content-type:mime-version:x-launchpad-project :x-launchpad-branch:x-launchpad-message-rationale :x-launchpad-branch-revision-number:x-launchpad-notification-type:to :from:subject:message-id:date:reply-to:sender:errors-to:precedence :x-generated-by:x-launchpad-hash:x-gm-message-state; bh=Tx9NVRY/GiE55K0frMzEL2o9rq0s0fJWEk63bzU3Ii8=; b=BpWyQlj+PKnFeN+55RzsOm8eIsxbBd70KbKk1sPMp4HNmwTWeCDwNyv5YN3rSiYxuD SaHT6TWawT3fZBQvXpW4fy87KuS5m6dnLFWFS8c8XegpkFcdvnMGoHGCy/wMoE4kLCKa 5Wz60OxZWaIWNbDl5RnIMngV/PjGLZQ0BHTofKlT1H+vDaopEkJmzsWIptvG4DW211HN GyG3d8FGbSz9to75kzlPq7IBe6MDWfrlGclQ/O2yzdONGuz4zvh6GRxjc1JtdC10CBz/ IdLkIBvPKEfr9YfbrZW9B5OU911Zne5J1cCA3cILAqJuNnjxDeQ/1HDrlghe4tr/XedV M6cg== X-Received: by 10.52.97.7 with SMTP id dw7mr142959vdb.38.1359433221737; Mon, 28 Jan 2013 20:20:21 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.145.101 with SMTP id st5csp117934veb; Mon, 28 Jan 2013 20:20:21 -0800 (PST) X-Received: by 10.194.238.5 with SMTP id vg5mr176731wjc.40.1359433220632; Mon, 28 Jan 2013 20:20:20 -0800 (PST) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id eg6si317731wib.111.2013.01.28.20.20.20 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 28 Jan 2013 20:20:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1U02gF-0006Ds-Of for ; Tue, 29 Jan 2013 04:20:20 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id A13E9E023D for ; Tue, 29 Jan 2013 04:20:19 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 546 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 546: sdmux fixes found while stress testing Message-Id: <20130129042019.22599.8527.launchpad@ackee.canonical.com> Date: Tue, 29 Jan 2013 04:20:19 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="16451"; Instance="launchpad-lazr.conf" X-Launchpad-Hash: 57af4502e227cbe345b2681ae29f472027005e02 X-Gm-Message-State: ALoCoQnuPQUAd85Vx2yH3dj2gzauFIpAhO5pFy7pHQkrxG3k9JgHdeET0XR/KRD9Wa6A4ctUKQKz Merge authors: Andy Doan (doanac) Related merge proposals: https://code.launchpad.net/~doanac/lava-dispatcher/sdmux-fixes/+merge/145285 proposed by: Andy Doan (doanac) ------------------------------------------------------------ revno: 546 [merge] committer: Andy Doan branch nick: lava-dispatcher timestamp: Mon 2013-01-28 22:19:10 -0600 message: sdmux fixes found while stress testing modified: lava_dispatcher/device/sdmux.py lava_dispatcher/device/sdmux.sh --- lp:lava-dispatcher https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk You are subscribed to branch lp:lava-dispatcher. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription === modified file 'lava_dispatcher/device/sdmux.py' --- lava_dispatcher/device/sdmux.py 2013-01-16 23:27:28 +0000 +++ lava_dispatcher/device/sdmux.py 2013-01-28 23:59:47 +0000 @@ -46,6 +46,20 @@ ) +def _flush_files(mntdir): + """ + calls to umount can fail because the files haven't completely been written + to disk. This helps make sure that happens and eliminates a warning + """ + for f in os.listdir('/proc/self/fd'): + # check for existances since listdir will include an fd for itself + if os.path.exists(f): + path = os.path.realpath('/proc/self/fd/%s' % f) + if path.startswith(mntdir): + os.fsync(int(f)) + os.close(int(f)) + + class SDMuxTarget(Target): """ This adds support for the "sd mux" device. An SD-MUX device is a piece of @@ -188,11 +202,12 @@ finally: logging.info('unmounting sdmux') try: + _flush_files(mntdir) subprocess.check_call(['umount', device]) except subprocess.CalledProcessError: - logging.exception('umount failed, re-try in 5 seconds') - time.sleep(5) - if subprocess.call(['umount', device]) == 0: + logging.exception('umount failed, re-try in 10 seconds') + time.sleep(10) + if subprocess.call(['umount', device]) != 0: logging.error( 'Unable to unmount sdmux device %s', device) === modified file 'lava_dispatcher/device/sdmux.sh' --- lava_dispatcher/device/sdmux.sh 2013-01-04 00:03:43 +0000 +++ lava_dispatcher/device/sdmux.sh 2013-01-28 23:59:47 +0000 @@ -51,7 +51,7 @@ echo " already on" 1>&2 else echo -n "${ID}" > /sys/bus/usb/drivers/usb/bind - sleep 2 + sleep 4 fi device_path=`ls $DIR 2>/dev/null` if [ $? -ne 0 ] ; then @@ -63,7 +63,9 @@ elif [ $ACTION = "off" ] ; then echo " Powering off sdmux: $ID" echo -n "${ID}" > /sys/bus/usb/drivers/usb/unbind + sleep 1 echo -n '0' > /sys/bus/usb/devices/$ID/power/autosuspend_delay_ms + sleep 1 echo -n 'auto' > /sys/bus/usb/devices/$ID/power/control sleep 2 elif [ $ACTION = "deventry" ] ; then