fsck: Check content of direct mode files (only when the inode cache thinks they are unmodified).
I wrote this earlier, but it never worked because it was looking at the .git/annex/object content, which is not there..
This commit is contained in:
parent
6490418a4e
commit
22afcdf2a5
4 changed files with 19 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -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 <joeyh@debian.org> Sat, 06 Apr 2013 15:24:15 -0400
|
||||
|
||||
|
|
|
@ -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]]
|
||||
|
|
Loading…
Add table
Reference in a new issue