From 634c3be2bba6a46e28aa997d7ab388ebf90b36a6 Mon Sep 17 00:00:00 2001 From: Aaron Date: Tue, 15 May 2012 13:05:46 -0700 Subject: [PATCH] [FileBackend] Avoid infinite loops when populating missing metadata in Swift. Change-Id: Ief13048256ee11caf3494d934eb5267f5eb71e8b --- includes/filerepo/backend/SwiftFileBackend.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/filerepo/backend/SwiftFileBackend.php b/includes/filerepo/backend/SwiftFileBackend.php index 0def61fc04..1eb8a34b0a 100644 --- a/includes/filerepo/backend/SwiftFileBackend.php +++ b/includes/filerepo/backend/SwiftFileBackend.php @@ -612,7 +612,8 @@ class SwiftFileBackend extends FileBackendStore { $status = Status::newGood(); $scopeLockS = $this->getScopedFileLocks( array( $path ), LockManager::LOCK_UW, $status ); if ( $status->isOK() ) { - $tmpFile = $this->getLocalCopy( array( 'src' => $path, 'latest' => 1 ) ); + # Do not stat the file in getLocalCopy() to avoid infinite loops + $tmpFile = $this->getLocalCopy( array( 'src' => $path, 'latest' => 1, 'nostat' => 1 ) ); if ( $tmpFile ) { $hash = $tmpFile->getSha1Base36(); if ( $hash !== false ) { @@ -848,7 +849,8 @@ class SwiftFileBackend extends FileBackendStore { return null; } - if ( !$this->fileExists( $params ) ) { + # Check the recursion guard to avoid loops when filling metadata + if ( empty( $params['nostat'] ) && !$this->fileExists( $params ) ) { return null; } -- 2.20.1