fsck: When checksumming a file fails due to a hardware fault, the file is now moved to the bad directory, and the fsck proceeds. Before, the fsck immediately failed.
This commit is contained in:
parent
ff629a1ec0
commit
8990d4cc68
4 changed files with 21 additions and 11 deletions
|
@ -95,16 +95,17 @@ selectExtension f
|
||||||
|
|
||||||
{- A key's checksum is checked during fsck. -}
|
{- A key's checksum is checked during fsck. -}
|
||||||
checkKeyChecksum :: Hash -> Key -> FilePath -> Annex Bool
|
checkKeyChecksum :: Hash -> Key -> FilePath -> Annex Bool
|
||||||
checkKeyChecksum hash key file = do
|
checkKeyChecksum hash key file = go `catchHardwareFault` hwfault
|
||||||
fast <- Annex.getState Annex.fast
|
|
||||||
mstat <- liftIO $ catchMaybeIO $ getFileStatus file
|
|
||||||
case (mstat, fast) of
|
|
||||||
(Just stat, False) -> do
|
|
||||||
filesize <- liftIO $ getFileSize' file stat
|
|
||||||
showSideAction "checksum"
|
|
||||||
check <$> hashFile hash file filesize
|
|
||||||
_ -> return True
|
|
||||||
where
|
where
|
||||||
|
go = do
|
||||||
|
fast <- Annex.getState Annex.fast
|
||||||
|
mstat <- liftIO $ catchMaybeIO $ getFileStatus file
|
||||||
|
case (mstat, fast) of
|
||||||
|
(Just stat, False) -> do
|
||||||
|
filesize <- liftIO $ getFileSize' file stat
|
||||||
|
showSideAction "checksum"
|
||||||
|
check <$> hashFile hash file filesize
|
||||||
|
_ -> return True
|
||||||
expected = keyHash key
|
expected = keyHash key
|
||||||
check s
|
check s
|
||||||
| s == expected = True
|
| s == expected = True
|
||||||
|
@ -114,6 +115,10 @@ checkKeyChecksum hash key file = do
|
||||||
| '\\' : s == expected = True
|
| '\\' : s == expected = True
|
||||||
| otherwise = False
|
| otherwise = False
|
||||||
|
|
||||||
|
hwfault e = do
|
||||||
|
warning $ "hardware fault: " ++ show e
|
||||||
|
return False
|
||||||
|
|
||||||
keyHash :: Key -> String
|
keyHash :: Key -> String
|
||||||
keyHash key = dropExtensions (keyName key)
|
keyHash key = dropExtensions (keyName key)
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,6 @@ import Utility.Exception
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Char
|
import Data.Char
|
||||||
import System.IO
|
import System.IO
|
||||||
import Control.Applicative
|
|
||||||
import Prelude
|
|
||||||
|
|
||||||
externalSHA :: String -> Int -> FilePath -> IO (Either String String)
|
externalSHA :: String -> Int -> FilePath -> IO (Either String String)
|
||||||
externalSHA command shasize file = do
|
externalSHA command shasize file = do
|
||||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -8,6 +8,9 @@ git-annex (5.20150523) UNRELEASED; urgency=medium
|
||||||
* Revert removal dependency on obsolete hamlet package, since the
|
* Revert removal dependency on obsolete hamlet package, since the
|
||||||
autobuilders are not ready for this change yet and it prevented them
|
autobuilders are not ready for this change yet and it prevented them
|
||||||
from building the webapp. Reopens: #786659
|
from building the webapp. Reopens: #786659
|
||||||
|
* fsck: When checksumming a file fails due to a hardware fault,
|
||||||
|
the file is now moved to the bad directory, and the fsck proceeds.
|
||||||
|
Before, the fsck immediately failed.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 22 May 2015 22:23:32 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 22 May 2015 22:23:32 -0400
|
||||||
|
|
||||||
|
|
|
@ -12,3 +12,7 @@ git-annex: sha1sum parse error
|
||||||
### What version of git-annex are you using? On what operating system?
|
### What version of git-annex are you using? On what operating system?
|
||||||
git-annex 5.20150508
|
git-annex 5.20150508
|
||||||
linux 4.0.4
|
linux 4.0.4
|
||||||
|
|
||||||
|
> [[fixed|done]]; IO errors are now detected and the file moved to bad/;
|
||||||
|
> the fsck also continues past that failure now, so if a disk has
|
||||||
|
> a lot of damanged files, it will find them all. --[[Joey]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue