Re: undo hangs

From:

Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>

Date:

Sun, 8 Nov 2009 19:10:36 -0800 (PST)

:I munged up a file, and wasn't able to retrieve the last version using
:undo on a Hammer volume:
:
:Do this on leaf:
:
:undo -o local.css.old /usr/pkg/share/ikiwiki/basewiki/local.css
:
:The process does not return:
:
:root 23659 0.0 0.0 1552 628 0 IL+ 7:30PM 0:00.00 undo -o
:local.css.old /usr/pkg/share/ikiwiki/basewiki/local.css
:
:Not sure if I just missed something... I was able to retrieve the file
:from a snapshot.
It's kinda a bug in undo. Basically undo is synthesizing ALL the
transaction ids ever used to update the file. But some of those
transaction ids bisect the directory entry and inode so the
directory entry might exist and the inode might not.
In the case where the inode does not exist HAMMER synthesizes a fake
one and unfortunately I chose the FIFO type (as in 'mkfifo' style) :-).
Bad choice on my fault. So undo winds up trying to open a FIFO and
of course hangs until you hit ^C since there is nobody on the other
side of the FIFO.
If someone would like a little mini project, just add a stat() or fstat()
call in the undo code and don't try to open() files that aren't regular
files. Plus generate a warning to stderr for that transaction id.
-Matt
Matthew Dillon
<dillon@backplane.com>