NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/47739: tmpfs panic: kernel diagnostic assertion "(node)->tn_spec.tn_dir.tn_readdir_lastp == NULL..."



Dennis Ferguson <dennis.c.ferguson%gmail.com@localhost> wrote:
> >>>> <...>
> >>> 
> >>> Most likely this is due to tmpfs_dircookie() truncation here:
> >>> 
> >>> http://nxr.netbsd.org/source/xref/src/sys/fs/tmpfs/tmpfs.h#88
> >>> 
> >>> It is wrong and there are other PRs because of it.  Thomas, you can
> >>> test this by replacing the function body with the following:
> >>> 
> >>>   return (off_t)(uintptr_t)de;
> >>> 
> >>> This breaks linux32 compat, but we really just need to decide how we
> >>> want to fix it (it would be good to avoid penalising the native code,
> >>> but better to penalise than fail).
> >> 
> >> <...>
> 
> Assuming my mail client doesn't ruin it I've attached a patch which adds
> a sequence number to each tmpfs directory entry.  The sequence numbers
> are kept sorted in the directory entry list TAILQ order because it doesn't
> cost anything much to do that in the current code and having a file
> offset with actual ordering semantics fixes some things that the current
> code can do wrong when directories are being read, like the EINVAL error
> that getdents(2) says only NFS file systems are supposed to return but
> which appears in the code here too.

I think there is a better way.  Here is the patch:

http://www.netbsd.org/~rmind/tmpfs_readdir_fixes.diff

 tmpfs.h        |   86 +++++--------
 tmpfs_rename.c |   14 +-
 tmpfs_subr.c   |  373 ++++++++++++++++++++++++++++++++-------------------------
 tmpfs_vfsops.c |   39 +++--
 tmpfs_vnops.c  |   75 ++++-------
 5 files changed, 309 insertions(+), 278 deletions(-)

It also fixes tmpfs_unmount() and the net diff seems better. :)

Thomas, can you try this patch on your build-hammer-machine?

Thanks.

-- 
Mindaugas


Home | Main Index | Thread Index | Old Index