Skip to contentSkip to conversation

Symlinks' device numbers differ from regular files'

DISCUSSION Toke Høiland-Jørgensen 2 participants 2 messages Nov 18, 2010 – Nov 19, 2010 Btrfs file system

lore
Share & tools
lore
#0 lore raw

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.

Regards,
-Toke Høiland-Jørgensen

#1 lore raw
Quoted 3 lines · Toke H=C3=B8iland-J=C3=B8rgensen wrote:

Hi
=20
I am having a problem with my btrfs partitions: symlinks are reported=

to=20

Quoted 1 line

have different device numbers than directories and regular files, eve=

n=20

Quoted 1 line

though they are on the same partition. This causes my backup software=

to=20

Quoted 7 lines

mess up backing up the symlinks.
=20
An illustrative example:
=20

$ touch tmp; ln -s tmp tmp2; stat tmp tmp2
  File: `tmp'
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty =

file

Quoted 11 lines

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 ---
=20

$ uname -r
2.6.35-ck
=20
I'm not using subvolumes, or any fancy features of btrfs, really. I'm=

=20

Quoted 6 lines

running Arch Linux.
=20
Is this normal? And if not, how do I fix it?
=20
Any help would be greatly appreciated. Thanks in advance. =20

This should fix it:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

[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 f=
ile
 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

---

fs/btrfs/inode.c +0 -0
index 5132c9a..d10b6d4 100644
@@ -7139,6 +7139,7 @@ static const struct inode_operations btrfs_symlin=

k_inode_operations =3D {
.readlink =3D generic_readlink,
.follow_link =3D page_follow_link_light,
.put_link =3D page_put_link,
+ .getattr =3D btrfs_getattr,
.permission =3D btrfs_permission,
.setxattr =3D btrfs_setxattr,
.getxattr =3D btrfs_getxattr,
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html