summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/bbackupd/BackupClientDirectoryRecord.cpp32
-rw-r--r--bin/bbackupd/BackupClientDirectoryRecord.h1
2 files changed, 31 insertions, 2 deletions
diff --git a/bin/bbackupd/BackupClientDirectoryRecord.cpp b/bin/bbackupd/BackupClientDirectoryRecord.cpp
index 6f14fa0c..ed72fe18 100644
--- a/bin/bbackupd/BackupClientDirectoryRecord.cpp
+++ b/bin/bbackupd/BackupClientDirectoryRecord.cpp
@@ -53,6 +53,7 @@ BackupClientDirectoryRecord::BackupClientDirectoryRecord(int64_t ObjectID, const
mSubDirName(rSubDirName),
mInitialSyncDone(false),
mSyncDone(false),
+ mSuppressMultipleLinksWarning(false),
mpPendingEntries(0)
{
::memset(mStateChecksum, 0, sizeof(mStateChecksum));
@@ -321,13 +322,40 @@ void BackupClientDirectoryRecord::SyncDirectory(
continue;
}
+ int type = file_st.st_mode & S_IFMT;
+
+ // ecryptfs reports nlink > 1 for directories
+ // with contents, but no filesystem supports
+ // hardlinking directories? so we can ignore
+ // this if the entry is a directory.
+ if(file_st.st_nlink != 1 && type == S_IFDIR)
+ {
+ BOX_INFO("Ignoring apparent hard link "
+ "count on directory: " <<
+ filename << ", nlink=" <<
+ file_st.st_nlink);
+ }
+ else if(file_st.st_nlink != 1)
+ {
+ if(!mSuppressMultipleLinksWarning)
+ {
+ BOX_WARNING("File is hard linked, this may "
+ "cause rename tracking to fail and "
+ "move files incorrectly in your "
+ "backup! " << filename <<
+ ", nlink=" << file_st.st_nlink <<
+ " (suppressing further warnings");
+ mSuppressMultipleLinksWarning = true;
+ }
+ SetErrorWhenReadingFilesystemObject(
+ rParams, filename.c_str());
+ }
+
BOX_TRACE("Stat entry '" << filename << "' "
"found device/inode " <<
file_st.st_dev << "/" <<
file_st.st_ino);
- int type = file_st.st_mode & S_IFMT;
-
/* Workaround for apparent btrfs bug, where
symlinks appear to be on a different filesystem
than their containing directory, thanks to
diff --git a/bin/bbackupd/BackupClientDirectoryRecord.h b/bin/bbackupd/BackupClientDirectoryRecord.h
index 1a03ff41..d9291520 100644
--- a/bin/bbackupd/BackupClientDirectoryRecord.h
+++ b/bin/bbackupd/BackupClientDirectoryRecord.h
@@ -156,6 +156,7 @@ private:
std::string mSubDirName;
bool mInitialSyncDone;
bool mSyncDone;
+ bool mSuppressMultipleLinksWarning;
// Checksum of directory contents and attributes, used to detect changes
uint8_t mStateChecksum[MD5Digest::DigestLength];