All of lore.kernel.org
 help / color / mirror / Atom feed
* A question on directory checksums
@ 2020-02-22 10:36 Bo Branten
  2020-02-22 18:49 ` Theodore Y. Ts'o
  2020-02-23 17:40 ` Bo Branten
  0 siblings, 2 replies; 3+ messages in thread
From: Bo Branten @ 2020-02-22 10:36 UTC (permalink / raw)
  To: linux-ext4


Hello,

I am implementing support for metadata checksums on an ext4 driver for 
another os and test this by writing something and then run e2fsck from 
Linux to see what it says. When I create a new empty directory that only 
contains . and .. I got this error message from e2fsck that I want to ask 
you to clearify:

bo@bo-desktop:~$ sudo e2fsck -pvf /dev/sdb2
/dev/sdb2: Directory inode 64, block #0, offset 0: directory has no checksum.
FIXED.

Am I right that it is not the checksum on the inode that represents the 
directory but the checksum in the directory entry tail in the first and 
only block?

Also do "no checksum" means something different than wrong checksum, like 
I have not initialized it correctly? (if I dont call 
initialize_dirent_tail I will get another error message from e2fsck that 
speficially says there is no room for the checksum so it can not be that)

Bo Branten

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A question on directory checksums
  2020-02-22 10:36 A question on directory checksums Bo Branten
@ 2020-02-22 18:49 ` Theodore Y. Ts'o
  2020-02-23 17:40 ` Bo Branten
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Y. Ts'o @ 2020-02-22 18:49 UTC (permalink / raw)
  To: Bo Branten; +Cc: linux-ext4

On Sat, Feb 22, 2020 at 11:36:43AM +0100, Bo Branten wrote:
> 
> Hello,
> 
> I am implementing support for metadata checksums on an ext4 driver for
> another os and test this by writing something and then run e2fsck from Linux
> to see what it says. When I create a new empty directory that only contains
> . and .. I got this error message from e2fsck that I want to ask you to
> clearify:
> 
> bo@bo-desktop:~$ sudo e2fsck -pvf /dev/sdb2
> /dev/sdb2: Directory inode 64, block #0, offset 0: directory has no checksum.
> FIXED.
> 
> Am I right that it is not the checksum on the inode that represents the
> directory but the checksum in the directory entry tail in the first and only
> block?

Yes.  It means the dirent tail is missing.

> Also do "no checksum" means something different than wrong checksum, like I
> have not initialized it correctly? (if I dont call initialize_dirent_tail I
> will get another error message from e2fsck that speficially says there is no
> room for the checksum so it can not be that)

I'm not sure what you message you are referring to in your
parenthetical comment.

I'm guessing you don't want to look at the e2fsck source code?  What
about using debugfs so you can see what the directory looks like
before and after running e2fsck.

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: A question on directory checksums
  2020-02-22 10:36 A question on directory checksums Bo Branten
  2020-02-22 18:49 ` Theodore Y. Ts'o
@ 2020-02-23 17:40 ` Bo Branten
  1 sibling, 0 replies; 3+ messages in thread
From: Bo Branten @ 2020-02-23 17:40 UTC (permalink / raw)
  To: linux-ext4

On Sat, 22 Feb 2020, Bo Branten wrote:

> /dev/sdb2: Directory inode 64, block #0, offset 0: directory has no checksum.

I think I should tell you how I solved this: It was a good advice to use 
debugfs, with it I could dump the directory block before and after running 
e2fsck and then I found out that it was rec_len in the last directory 
entry in a block that we did not initialize correctly, before it should 
extend to the end of the block but with cecksums we should subtract 
sizeof(struct ext4_dir_entry_tail) from it, thats why e2fsck did not look 
at the checksum even if it was there.

Thank you for youre help.

Bo Branten


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-23 17:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-22 10:36 A question on directory checksums Bo Branten
2020-02-22 18:49 ` Theodore Y. Ts'o
2020-02-23 17:40 ` Bo Branten

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.