Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Kup
Kup
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • System
  • KupKup
  • Issues
  • #12

Closed
Open
Created Feb 03, 2021 by Sebastian Goth@sgothContributor

FSExecutor fails to detect auto mounted storage

If kup-daemon is started when my NAS is offline, it fails to detect when it comes back up. I use systemd auto mounting.

My plan's destination path is: /share/nas/home/foo.bup

/etc/fstab

//nas0/homes/<some> /share/nas/home  cifs user,noauto,nofail,x-systemd.automount,x-systemd.device-timeout=10,x-systemd.idle-timeout=0,<somemoreopts> 0 0

/proc/mounts | grep nas/home before mount

systemd-1 /share/nas/home autofs <mountopts> 0 0

/proc/mounts | grep nas/home after starting NAS and ls /share/nas/home

systemd-1 /share/nas/home autofs <mountopts> 0 0
//nas0/homes/<some> /share/nas/home cifs <mountopts> 0 0

MountWatcher correctly detects the appearance of the mount and calls FSExecutor::checkMountPoints. There, mWatchedParentDir is /share/nas which is "incorrect" as it should be /share/nas/home.

	QDir lDir(mDestinationPath);
	if(!lDir.exists()) {
		// Destination doesn't exist, find nearest existing parent folder and
		// watch that for dirty or deleted
		if(mDirWatch->contains(mDestinationPath)) {
			mDirWatch->removeDir(mDestinationPath);
		}

		QString lExisting = mDestinationPath;
		do {
			lExisting += QStringLiteral("/..");
			lDir = QDir(QDir::cleanPath(lExisting));
		} while(!lDir.exists());
		lExisting = lDir.canonicalPath();

The issue is that lDir.exists() returns false for the actual mount point /share/nas/home when it shouldn't.

Yet various checks behave differently. [ -d /share/nas/home ] && echo ok says 'ok' ls,stat(1),opendir(3) error with "no such device".

Luckily stat(3) seems to work fine. So i propose to use that, at least for the parent-dir-detection.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None