inode->i_rdev not initialized in 2.4 fs/inode.c, only in 2.6?

From: Iustin Pop
Date: Mon Oct 27 2003 - 18:46:42 EST


Hello,

I'm running 2.4.22 (with XFS and skas patch), but these patches do not
affect the code in question. /proc/version = Linux version 2.4.22-xfs
(root@saytrin) (gcc version 3.3.2 20030908 (Debian prerelease))

I get strange results (st.st_rdev != 0) in userspace after stat on some
non-devices regular file/directory. On one computer, /etc gives 773 and
/etc/init.d 0, while on another /etc gives 0 and /etc/init.d 13478.

After gdb and seeing it comes from kernel, I looked around and saw that
in fs/inode.c, i_rdev is not zeroed. Nor does it *seem* that
kmem_cache_alloc clears the memory, but I could be mistaken, it's
complicated code (I think it only clears at cache creation). And r_dev
is what gets transformed into st_rdev in fs/stat.c

2.6 fixes this behavior, by saying "inode->i_rdev = to_kdev_t(0);".
Shouldn't this be also in 2.4?

Thanks,
Iustin Pop

Please CC me as I'm not on the list.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/