#156 st_dev from stat(2) doesn't include node

Filesystem (49)
John Hughes

Recipe for confusion. Two nodes have identical hardware, they both have an identical filesystem on /dev/hda1.

Mount the two filesystems, and try to copy a file with the same inode# from one to another:

# onall grep hda1 /proc/mounts
(node 1)
/dev/1/hda1 /boot cfs rw,node=1 0 0
(node 2)
/dev/hda1 /mnt cfs rw,node=2 0 0
# ls -li /boot/grub/menu.lst /mnt/grub/menu.lst
46190 -rw-r--r-- 1 root root 4033 2008-04-22 15:18 /boot/grub/menu.lst
46190 -rw-r--r-- 1 root root 4033 2008-04-22 15:34 /mnt/grub/menu.lst
# cp /boot/grub/menu.lst /mnt/grub/menu.lst
cp: `/boot/grub/menu.lst' and `/mnt/grub/menu.lst' are the same file

Problem is that cp thinks they're the same file if they've got the same st_dev (which they do) and st_inode (which they do).

In this case it happened 'cos I copied the filesystem between the two nodes, but it could happen randomly if filesystems are mounted on more than one node.


  • Roger Tsang

    Roger Tsang - 2008-05-24

    Logged In: YES
    Originator: NO

    Not worth mucking with coreutils for something this rare plus we're not going to touch VFS, ask the architect. Can be worked around by sysadmin.

  • Roger Tsang

    Roger Tsang - 2008-05-24
    • labels: --> Filesystem
    • milestone: --> default
    • priority: 5 --> 1
    • status: open --> closed-wont-fix

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks