diff mbox

[OSSTEST,4/5] cr-ensure-disk-space: Run check_space before taking lock

Message ID 1469020751-12413-4-git-send-email-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ian Jackson July 20, 2016, 1:19 p.m. UTC
This allows cr-ensure-disk-space to be a noop if there is enough
space, even if run on a host which doesn't have access to the relevant
lock directory.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
---
 cr-ensure-disk-space | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/cr-ensure-disk-space b/cr-ensure-disk-space
index 63e92f4..2d299dd 100755
--- a/cr-ensure-disk-space
+++ b/cr-ensure-disk-space
@@ -61,6 +61,8 @@  sub check_space () {
     return $space >= logcfg('MinSpaceMby');
 }
 
+exit 0 if check_space;
+
 my $lock = "$c{GlobalLockDir}/publish-lock";
 open LOCK, "> $lock" or die "$lock $!";
 flock LOCK, LOCK_EX or die $!;