Move path_root check up so path() and get_mnt_sb() can be avoided in the cases _do_get_path() fails.

This commit is contained in:
Gustavo Moreira
2022-05-09 19:38:25 +10:00
parent 73a42577d7
commit 2c181fb9be
@@ -89,6 +89,10 @@ class MountInfo(plugins.PluginInterface):
if not mnt_root:
return None
path_root = cls._do_get_path(mnt, task.fs.root)
if path_root is None:
return None
mnt_root_path = mnt_root.path()
superblock = mnt.get_mnt_sb()
@@ -97,10 +101,6 @@ class MountInfo(plugins.PluginInterface):
st_dev = f"{superblock.major}:{superblock.minor}"
path_root = cls._do_get_path(mnt, task.fs.root)
if path_root is None:
return None
mnt_opts: List[str] = []
mnt_opts.append(mnt.get_flags_access())
mnt_opts.extend(mnt.get_flags_opts())