diff --git a/lib/rpc.py b/lib/rpc.py
index c9ac36fe07b2ddbf4aabbb67fb5eea8bfeca92c1..3b007509dcf56d894a02b158b056e76f94c209f2 100644
--- a/lib/rpc.py
+++ b/lib/rpc.py
@@ -30,7 +30,6 @@
 # if they need to start using instance attributes
 # R0904: Too many public methods
 
-import os
 import logging
 import zlib
 import base64
@@ -520,9 +519,9 @@ def _PrepareFileUpload(getents_fn, filename):
   """Loads a file and prepares it for an upload to nodes.
 
   """
-  # TODO: Use ReadFile(preread=...) and os.fstat
-  data = _Compress(utils.ReadFile(filename))
-  st = os.stat(filename)
+  statcb = utils.FileStatHelper()
+  data = _Compress(utils.ReadFile(filename, preread=statcb))
+  st = statcb.st
 
   if getents_fn is None:
     getents_fn = runtime.GetEnts