Commit Graph

17 Commits

Author SHA1 Message Date
Jakob Unterwurzacher c1a2a36a79 fsck: don't misdetect a file hole at EOF
https://github.com/rfjakob/gocryptfs/issues/304 :

A second minor issue is that `if bytes.Equal(buf, allZero) {` compares the whole
buffer, although the last read could have been shorter. This could trigger the
"skip file hole" code at the end of a file although there isn't any hole to
skip.
2019-01-04 20:26:16 +01:00
Sebastian Lackner cdb57ca7e0 fsck: Do not show files/directories without access permissions as corrupt.
When running as a regular user, error EACCES does not necessarily mean that the
file/directory/xattr is corrupt, but just that we do not have sufficient access
permissions. Add a hint that running as root can be used to check everything.

Fixes: https://github.com/rfjakob/gocryptfs/issues/309
2019-01-04 09:34:12 +01:00
Sebastian Lackner 874eaf9734 Assorted spelling fixes.
Mostly detected with the 'codespell' utility, but also includes some
manual grammar fixes.
2018-12-27 15:19:55 +01:00
Jakob Unterwurzacher 0e1cbb75fe fsck: skip already-seen hard-linked files
We may hit files several times due to hard links.
Only check the contents once.
2018-08-15 14:02:05 +02:00
Jakob Unterwurzacher db4accf3a3 fsck: don't print corse corruption offset
The exact ciphertext block number (4KiB granularity) is
already printed in the doRead message. Don't cause
confusion by printing the 128KiB-granularity offset as
well.

  doRead 767: corrupt block #4: stupidgcm: message authentication failed
  fsck: error reading file "pa/d7/d14/f10c" (inum 767): 5=input/output error
2018-08-15 13:20:40 +02:00
Jakob Unterwurzacher d620054caf fsck: print inode number on file read error
This makes it possible to find the file without mounting the fs.
2018-07-23 22:34:41 +02:00
Jakob Unterwurzacher 38f79a1abc fsck: add debug output (enabled via -debug)
Turn the commented-out fmt.Printf into debug output
via the tlog infrastructure.
2018-07-15 11:34:30 +02:00
Jakob Unterwurzacher 2d68b06f9d fsck: handle sparse files efficiently, fix xfstests generic/285
If we encounter a 128KB block of zeros, try to skip to the next
data section by calling File.SeekData().

This fixes xfstests generic/285, which creates a 17TB sparse file,
and runs fsck afterwards. Without this optimization, fsck would
take ages.
2018-07-01 21:48:51 +02:00
Jakob Unterwurzacher 4a73637782 fsck: get rid of channel read closures
Create proper functions instead to declutter the logic.
2018-07-01 20:56:22 +02:00
Jakob Unterwurzacher 1a18d8e609 fsck: rename "CorruptItems" channel to "MitigatedCorruptions"
Make it clear that this channel is only used to report corruptions
that are transparently mitigated and do not return an error to
the user.
2018-07-01 20:56:22 +02:00
Jakob Unterwurzacher 283184dd5a fsck: suppress "no problems found" when running quiet
Passing "-q" now disables the "fsck summary: no problems found\n"
message.
2018-07-01 20:56:22 +02:00
Jakob Unterwurzacher 4e5783591f fsck: report skipped corrupt files
OpenDir and ListXAttr skip over corrupt entries,
readFileID treats files the are too small as empty.
This improves usability in the face of corruption,
but hides the problem in a log message instead of
putting it in the return code.

Create a channel to report these corruptions to fsck
so it can report them to the user.

Also update the manpage and the changelog with the -fsck option.

Closes https://github.com/rfjakob/gocryptfs/issues/191
2018-04-03 21:24:48 +02:00
Jakob Unterwurzacher 8b443c8484 fsck: add xattr support
With testcases.
2018-04-02 20:25:59 +02:00
Jakob Unterwurzacher b6c8960b01 fsck: clean up log output
Make sure we get only 1 warning output per
problem.

Also, add new corruption types to broken_fs_v1.4.
2018-04-02 18:32:30 +02:00
Jakob Unterwurzacher e6caf56ea4 fsck: sort files alphabetically
This makes fsck runs deterministic.
2018-04-02 16:56:29 +02:00
Jakob Unterwurzacher f28d85fad5 fsck: add initial implementation
Most corruption cases except xattr should be covered.
With test filesystem.

The output is still pretty ugly. xattr support will
be added in the next commits.
2018-04-02 16:38:18 +02:00
Jakob Unterwurzacher 8fcd39a3b0 main: add "-fsck" flag
The fsck operation is not yet implemented, this commits
just adds the flag and improves cli flag handling.
2018-04-01 14:25:10 +02:00