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
|
, verifyLocationLog key file
|
||||||
, verifyDirectMapping key file
|
, verifyDirectMapping key file
|
||||||
, checkKeySize key
|
, checkKeySize key
|
||||||
, checkBackend backend key
|
, checkBackend backend key (Just file)
|
||||||
, checkKeyNumCopies key file numcopies
|
, checkKeyNumCopies key file numcopies
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ performBare :: Key -> Backend -> Annex Bool
|
||||||
performBare key backend = check
|
performBare key backend = check
|
||||||
[ verifyLocationLog key (key2file key)
|
[ verifyLocationLog key (key2file key)
|
||||||
, checkKeySize key
|
, checkKeySize key
|
||||||
, checkBackend backend key
|
, checkBackend backend key Nothing
|
||||||
]
|
]
|
||||||
|
|
||||||
check :: [Annex Bool] -> Annex Bool
|
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
|
- because modification of direct mode files is allowed. It's still done
|
||||||
- if the file does not appear modified, to catch disk corruption, etc.
|
- if the file does not appear modified, to catch disk corruption, etc.
|
||||||
-}
|
-}
|
||||||
checkBackend :: Backend -> Key -> Annex Bool
|
checkBackend :: Backend -> Key -> Maybe FilePath -> Annex Bool
|
||||||
checkBackend backend key = do
|
checkBackend backend key mfile = go =<< isDirect
|
||||||
file <- calcRepo $ gitAnnexLocation key
|
where
|
||||||
ifM isDirect
|
go False = do
|
||||||
( ifM (goodContent key file)
|
content <- calcRepo $ gitAnnexLocation key
|
||||||
( checkBackendOr' (badContentDirect file) backend key file
|
checkBackendOr badContent backend key content
|
||||||
(goodContent key file)
|
go True = maybe nocheck checkdirect mfile
|
||||||
, return True
|
checkdirect file = ifM (goodContent key file)
|
||||||
)
|
( checkBackendOr' (badContentDirect file) backend key file
|
||||||
, checkBackendOr badContent backend key file
|
(goodContent key file)
|
||||||
|
, nocheck
|
||||||
)
|
)
|
||||||
|
nocheck = return True
|
||||||
|
|
||||||
checkBackendRemote :: Backend -> Key -> Remote -> Maybe FilePath -> Annex Bool
|
checkBackendRemote :: Backend -> Key -> Remote -> Maybe FilePath -> Annex Bool
|
||||||
checkBackendRemote backend key remote = maybe (return True) go
|
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. -}
|
- be other files still pointing at that key. -}
|
||||||
perform :: FilePath -> Key -> Backend -> Backend -> CommandPerform
|
perform :: FilePath -> Key -> Backend -> Backend -> CommandPerform
|
||||||
perform file oldkey oldbackend newbackend = do
|
perform file oldkey oldbackend newbackend = do
|
||||||
ifM (Command.Fsck.checkBackend oldbackend oldkey)
|
ifM (Command.Fsck.checkBackend oldbackend oldkey (Just file))
|
||||||
( maybe stop go =<< genkey
|
( maybe stop go =<< genkey
|
||||||
, stop
|
, 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
|
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.
|
re-used when setting up additional repositories on the same server.
|
||||||
* Fall back to internal url downloader when built without curl.
|
* 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
|
-- 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.
|
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