Re: Symlinks' device numbers differ from regular files'

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

 



Toke HÃiland-JÃrgensen wrote:
> Hi
> 
> I am having a problem with my btrfs partitions: symlinks are reported to 
> have different device numbers than directories and regular files, even 
> though they are on the same partition. This causes my backup software to 
> mess up backing up the symlinks.
> 
> An illustrative example:
> 
> $ 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
> --- snip ---
> 
> $ uname -r
> 2.6.35-ck
> 
> I'm not using subvolumes, or any fancy features of btrfs, really. I'm 
> running Arch Linux.
> 
> Is this normal? And if not, how do I fix it?
> 
> Any help would be greatly appreciated.  Thanks in advance.
> 

This should fix it:

=============

[PATCH] btrfs: Show device attr correctly for symlinks

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@xxxxxxx>
Signed-off-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
---
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5132c9a..d10b6d4 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7139,6 +7139,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,
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux