diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 9a81f986b5..1c9af0d345 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -112,7 +112,7 @@ perform key file backend numcopies = check , verifyLocationLog key file , verifyDirectMapping key file , checkKeySize key - , checkBackend backend key + , checkBackend backend key (Just file) , checkKeyNumCopies key file numcopies ] @@ -177,7 +177,7 @@ performBare :: Key -> Backend -> Annex Bool performBare key backend = check [ verifyLocationLog key (key2file key) , checkKeySize key - , checkBackend backend key + , checkBackend backend key Nothing ] check :: [Annex Bool] -> Annex Bool @@ -321,17 +321,19 @@ checkKeySizeOr bad key file = case Types.Key.keySize key of - because modification of direct mode files is allowed. It's still done - if the file does not appear modified, to catch disk corruption, etc. -} -checkBackend :: Backend -> Key -> Annex Bool -checkBackend backend key = do - file <- calcRepo $ gitAnnexLocation key - ifM isDirect - ( ifM (goodContent key file) - ( checkBackendOr' (badContentDirect file) backend key file - (goodContent key file) - , return True - ) - , checkBackendOr badContent backend key file +checkBackend :: Backend -> Key -> Maybe FilePath -> Annex Bool +checkBackend backend key mfile = go =<< isDirect + where + go False = do + content <- calcRepo $ gitAnnexLocation key + checkBackendOr badContent backend key content + go True = maybe nocheck checkdirect mfile + checkdirect file = ifM (goodContent key file) + ( checkBackendOr' (badContentDirect file) backend key file + (goodContent key file) + , nocheck ) + nocheck = return True checkBackendRemote :: Backend -> Key -> Remote -> Maybe FilePath -> Annex Bool checkBackendRemote backend key remote = maybe (return True) go diff --git a/Command/Migrate.hs b/Command/Migrate.hs index e0ef650b08..d8bfd74f17 100644 --- a/Command/Migrate.hs +++ b/Command/Migrate.hs @@ -55,7 +55,7 @@ upgradableKey backend key = isNothing (Types.Key.keySize key) || backendupgradab - be other files still pointing at that key. -} perform :: FilePath -> Key -> Backend -> Backend -> CommandPerform perform file oldkey oldbackend newbackend = do - ifM (Command.Fsck.checkBackend oldbackend oldkey) + ifM (Command.Fsck.checkBackend oldbackend oldkey (Just file)) ( maybe stop go =<< genkey , stop ) diff --git a/debian/changelog b/debian/changelog index 94bb249b9d..48a307a873 100644 --- a/debian/changelog +++ b/debian/changelog @@ -40,6 +40,8 @@ git-annex (4.20130406) UNRELEASED; urgency=low ssh key name, so that a locked down ssh key for one repository is not re-used when setting up additional repositories on the same server. * Fall back to internal url downloader when built without curl. + * fsck: Check content of direct mode files (only when the inode cache + thinks they are unmodified). -- Joey Hess Sat, 06 Apr 2013 15:24:15 -0400 diff --git a/doc/bugs/git_annex_fsck_in_direct_mode_does_not_checksum_files.mdwn b/doc/bugs/git_annex_fsck_in_direct_mode_does_not_checksum_files.mdwn index a52a3c4fdb..9563f06836 100644 --- a/doc/bugs/git_annex_fsck_in_direct_mode_does_not_checksum_files.mdwn +++ b/doc/bugs/git_annex_fsck_in_direct_mode_does_not_checksum_files.mdwn @@ -14,4 +14,5 @@ git-annex version: 4.20130405, Linux Please provide any additional information below. - +> I've fixed it, fsck is indeed checksumming direct mode files now, as long +> as they're not known to be modified. [[done]] --[[Joey]]