#include "fd-util.h"
#include "find-esp.h"
#include "gpt.h"
+#include "mount-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "stat-util.h"
if (r < 0 && r != -EADDRNOTAVAIL)
return log_error_errno(r, "Failed to extract filename of %s: %m", p);
+ /* Trigger any automounts so that xstatfsat() operates on the mount instead of the mountpoint
+ * directory. */
+ r = trigger_automount_at(pfd, f);
+ if (r < 0)
+ return log_error_errno(r, "Failed to trigger automount at %s: %m", p);
+
r = xstatfsat(pfd, strempty(f), &sfs);
if (r < 0)
/* If we are searching for the mount point, don't generate a log message if we can't find the path */
return make_mount_point_inode_from_stat(&st, dest, mode);
}
+
+int trigger_automount_at(int dir_fd, const char *path) {
+ _cleanup_free_ char *nested = NULL;
+
+ assert(dir_fd >= 0 || dir_fd == AT_FDCWD);
+
+ nested = path_join(path, "a");
+ if (!nested)
+ return -ENOMEM;
+
+ (void) faccessat(dir_fd, nested, F_OK, 0);
+
+ return 0;
+}
/* Creates a mount point (not parents) based on the source path or stat - ie, a file or a directory */
int make_mount_point_inode_from_stat(const struct stat *st, const char *dest, mode_t mode);
int make_mount_point_inode_from_path(const char *source, const char *dest, mode_t mode);
+
+int trigger_automount_at(int dir_fd, const char *path);