gocryptfs: CIFS/SMB: Read error due to assumed corrupt block with all-zero nonce

I’ve got a rather big gocryptfs mount (a bit over 8 TB data). Reading a few lately added files (each with a few GB each) I get Eingabe-/Ausgabefehler (input/output error) when accessing a little part (I guess: exactly one block) inside them.

Running gocryptfs -fsck /mnt/vault_cipherdir I get this output (names shortend, numbers original):

doRead 71020: corrupt block #29792: all-zero nonce
fsck: error reading file "foo/bar1/abc" (inum 71020): 5=input/output error
doRead 71017: corrupt block #2328: all-zero nonce
fsck: error reading file "foo/bar2/def" (inum 71017): 5=input/output error
doRead 71012: corrupt block #4968: all-zero nonce
fsck: error reading file "foo/bar3/ghi" (inum 71012): 5=input/output error
doRead 71009: corrupt block #2480: all-zero nonce
fsck: error reading file "foo/bar4/jkl" (inum 71009): 5=input/output error
doRead 71006: corrupt block #3920: all-zero nonce
fsck: error reading file "foo/bar5/mno" (inum 71006): 5=input/output error
doRead 71001: corrupt block #127896: all-zero nonce
fsck: error reading file "foo/bar6/pqr" (inum 71001): 5=input/output error
doRead 71003: corrupt block #40976: all-zero nonce
fsck: error reading file "foo/bar7/stu" (inum 71003): 5=input/output error

Things I already did:

  • Checked the cipherdir - everything looks fine. It’s a CIFS/SMB3 mount of a rather new NAS that has rather new HDDs in a RAID5 configuration with good RAID health and good HDD SMART values. So I’m confident the underlying storage is fine.
  • hexdump -n 512 -s 0 foo/bar2/def looks good (as expected)
  • hexdump -n 512 -s $((1024*4*2328)) foo/bar2/def looks bad and gives the Eingabe-/Ausgabefehler (as expected). In /var/log/syslog it creates two entries gocryptfs[6457]: doRead 71017: corrupt block #2328: all-zero nonce
  • hexdump -n 512 -s 0 /mnt/vault_cipherdir/<EncryptedPathToSameFile> looks good (as expected)
  • hexdump -n 512 -s $((1024*4*2328)) /mnt/vault_cipherdir/<EncryptedPathToSameFile> also looks good (as hoped for as it shows that the underlying system is working correctly) and prints a bunch of “random” bytes
  • Copied that same original file (with a new file name) in the same directory (foo/bar2/def) again. No error messages.
  • Reading the full file (md5sum foo/bar2/def2) I get an Eingabe-/Ausgabefehler for this file as well (/var/log/syslog says this time twice: gocryptfs[6457]: doRead 71074: corrupt block #88480: all-zero nonce)

What I think is curious: all the inums are just above 71000. Coincidence?

Is this information enough for you to fix the issue - or do you need more information from me?

gocryptfs --version gives gocryptfs 1.7.1; go-fuse 0.0~git20190214.58dcd77; 2019-12-26 go1.13.5 linux/amd64

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 24 (8 by maintainers)

Most upvoted comments

Sync writes seems to make it so that the error disappears, ie. using cp all large files get corrupted, while if writing with using dd oflag=sync,dsync they never do.

I’ve been trying out gocryptfs over samba/cifs for a while and suddenly hit this. Seems to coincide with upgrading to kernel 6.9, but I’m not entirely certain. Haven’t got too much time to test it right now, but thought I’d give a heads up.