All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Symlinks' device numbers differ from regular files'
Date: Fri, 19 Nov 2010 10:05:24 +0800	[thread overview]
Message-ID: <4CE5DB64.3010102@cn.fujitsu.com> (raw)
In-Reply-To: <20101118235423.GC12925@toke.dk>

Toke H=C3=B8iland-J=C3=B8rgensen wrote:
> Hi
>=20
> I am having a problem with my btrfs partitions: symlinks are reported=
 to=20
> have different device numbers than directories and regular files, eve=
n=20
> though they are on the same partition. This causes my backup software=
 to=20
> 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
> 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
> 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

Reported-by: Toke H=C3=B8iland-J=C3=B8rgensen <toke@toke.dk>
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
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_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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2010-11-19  2:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18 23:54 Symlinks' device numbers differ from regular files' Toke Høiland-Jørgensen
2010-11-19  2:05 ` Li Zefan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CE5DB64.3010102@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=toke@toke.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.