Changeset 2977 for box/trunk/bin


Ignore:
Timestamp:
29/07/2011 19:52:25 (10 months ago)
Author:
chris
Message:

Warn users if a file with multiple hard links is encountered during backup.

Location:
box/trunk/bin/bbackupd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/bin/bbackupd/BackupClientDirectoryRecord.cpp

    r2877 r2977  
    5454          mInitialSyncDone(false), 
    5555          mSyncDone(false), 
     56          mSuppressMultipleLinksWarning(false), 
    5657          mpPendingEntries(0) 
    5758{ 
     
    322323                                } 
    323324 
     325                                int type = file_st.st_mode & S_IFMT; 
     326 
     327                                // ecryptfs reports nlink > 1 for directories 
     328                                // with contents, but no filesystem supports 
     329                                // hardlinking directories? so we can ignore 
     330                                // this if the entry is a directory. 
     331                                if(file_st.st_nlink != 1 && type == S_IFDIR) 
     332                                { 
     333                                        BOX_INFO("Ignoring apparent hard link " 
     334                                                "count on directory: " << 
     335                                                filename << ", nlink=" << 
     336                                                file_st.st_nlink); 
     337                                } 
     338                                else if(file_st.st_nlink != 1) 
     339                                { 
     340                                        if(!mSuppressMultipleLinksWarning) 
     341                                        { 
     342                                                BOX_WARNING("File is hard linked, this may " 
     343                                                        "cause rename tracking to fail and " 
     344                                                        "move files incorrectly in your " 
     345                                                        "backup! " << filename <<  
     346                                                        ", nlink=" << file_st.st_nlink << 
     347                                                        " (suppressing further warnings"); 
     348                                                mSuppressMultipleLinksWarning = true; 
     349                                        } 
     350                                        SetErrorWhenReadingFilesystemObject( 
     351                                                rParams, filename.c_str()); 
     352                                } 
     353 
    324354                                BOX_TRACE("Stat entry '" << filename << "' " 
    325355                                        "found device/inode " << 
    326356                                        file_st.st_dev << "/" << 
    327357                                        file_st.st_ino); 
    328  
    329                                 int type = file_st.st_mode & S_IFMT; 
    330358 
    331359                                /* Workaround for apparent btrfs bug, where 
  • box/trunk/bin/bbackupd/BackupClientDirectoryRecord.h

    r2848 r2977  
    157157        bool            mInitialSyncDone; 
    158158        bool            mSyncDone; 
     159        bool            mSuppressMultipleLinksWarning; 
    159160 
    160161        // Checksum of directory contents and attributes, used to detect changes 
Note: See TracChangeset for help on using the changeset viewer.