btrfs: Show device attr correctly for symlinks
authorLi Zefan <lizf@cn.fujitsu.com>
Fri, 19 Nov 2010 02:05:24 +0000 (02:05 +0000)
committerChris Mason <chris.mason@oracle.com>
Mon, 22 Nov 2010 03:26:07 +0000 (22:26 -0500)
Symlinks and files of other types show different device numbers, though
they are on the same partition:

 $ touch tmp; ln -s tmp tmp2; stat tmp tmp2
   File: `tmp'
   Size: 0          Blocks: 0          IO Block: 4096   regular empty file
 Device: 15h/21d Inode: 984027      Links: 1
 --- snip ---
   File: `tmp2' -> `tmp'
   Size: 3          Blocks: 0          IO Block: 4096   symbolic link
 Device: 13h/19d Inode: 984028      Links: 1

Reported-by: Toke Høiland-Jørgensen <toke@toke.dk>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/inode.c

index a47e4faa8c46aacd95d446fb33c5cb18e1ce3f43..eed357ff6c99720996d896e1752306c4ebdd0fc9 100644 (file)
@@ -7299,6 +7299,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = {
        .readlink       = generic_readlink,
        .follow_link    = page_follow_link_light,
        .put_link       = page_put_link,
+       .getattr        = btrfs_getattr,
        .permission     = btrfs_permission,
        .setxattr       = btrfs_setxattr,
        .getxattr       = btrfs_getxattr,