in rd-agent/src/misc/sideloader.py [0:0]
def __check_and_fix_rootfs(self):
toks = None
for line in read_lines("/proc/mounts"):
toks = line.split()
if toks[1] == "/":
break
if toks is None or toks[1] != "/":
return ["failed to find root fs mount entry"]
if toks[2] != "btrfs":
return ["root filesystem is not btrfs"]
if "discard=async" in toks[3]:
return []
fixed = ""
if self.fix:
try:
subprocess.check_call(["mount", "-o", "remount,discard=async", "/"])
except Exception as e:
return [f"failed to enable async discard on root fs ({e})"]
self.fixed = True
fixed = ", enabled"
return [f"async discard disabled on root fs{fixed}"]