[Box Backup-commit] COMMIT r2977 - box/trunk/bin/bbackupd
subversion at boxbackup.org
subversion at boxbackup.org
Fri Jul 29 19:52:26 BST 2011
Author: chris
Date: 2011-07-29 19:52:25 +0100 (Fri, 29 Jul 2011)
New Revision: 2977
Modified:
box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp
box/trunk/bin/bbackupd/BackupClientDirectoryRecord.h
Log:
Warn users if a file with multiple hard links is encountered during backup.
Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp
===================================================================
--- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2011-06-30 22:02:49 UTC (rev 2976)
+++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp 2011-07-29 18:52:25 UTC (rev 2977)
@@ -53,6 +53,7 @@
mSubDirName(rSubDirName),
mInitialSyncDone(false),
mSyncDone(false),
+ mSuppressMultipleLinksWarning(false),
mpPendingEntries(0)
{
::memset(mStateChecksum, 0, sizeof(mStateChecksum));
@@ -321,13 +322,40 @@
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
Modified: box/trunk/bin/bbackupd/BackupClientDirectoryRecord.h
===================================================================
--- box/trunk/bin/bbackupd/BackupClientDirectoryRecord.h 2011-06-30 22:02:49 UTC (rev 2976)
+++ box/trunk/bin/bbackupd/BackupClientDirectoryRecord.h 2011-07-29 18:52:25 UTC (rev 2977)
@@ -156,6 +156,7 @@
std::string mSubDirName;
bool mInitialSyncDone;
bool mSyncDone;
+ bool mSuppressMultipleLinksWarning;
// Checksum of directory contents and attributes, used to detect changes
uint8_t mStateChecksum[MD5Digest::DigestLength];
More information about the Boxbackup-commit
mailing list