linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Wagin <avagin@gmail.com>
To: Chris Mason <chris.mason@fusionio.com>
Cc: kzak@redhat.com, xemul@openvz.org, Mark Fasheh <mfasheh@suse.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: btrfs: stat(2) and /proc/pid/maps returns different devices
Date: Fri, 5 Jul 2013 12:06:33 +0400	[thread overview]
Message-ID: <CANaxB-wvUcs2bKjrJUtKQxojFM86kF-oLwdWcm9d0i2MjHCJ6g@mail.gmail.com> (raw)
In-Reply-To: <20130704095138.GB12359@gmail.com>

2013/7/4 Andrew Vagin <avagin@gmail.com>:
> Hi All,
>
> I want to resurrect an old problem. Currently stat(2) returns another
> device than other places where the device is printed (/proc/pid/maps,
> /proc/pid/fdinfo/, unix-diag). stat(2) reports devices, which is absent
> in /proc/pid/mountinfo.

Hi Chris,

I found that this issue was introduced by yours changes:

commit 3394e1607eaf870ebba37d303fbd590a4c569908
Author: Chris Mason <chris.mason@oracle.com>
Date:   Mon Nov 17 20:42:26 2008 -0500

    Btrfs: Give each subvol and snapshot their own anonymous devid

Now we need to find a way how to fix other places (not only stat(2)).

Could you look at Mark Fasheh's fix and my points, why we can't use
vfs_getattr in this case? Maybe you will have any ideas or comments
about this issue.

Thanks

>
> # cat /proc/self/mountinfo | grep mnt
> 40 32 0:32 / /mnt rw,relatime shared:27 - btrfs /dev/loop0 rw,noacl,space_cache
>
> # cat /proc/2943/maps
> 00400000-00406000 r-xp 00000000 00:20 260 /mnt/xxx/sleep
>
> # stat -L -c "%D" /proc/2943/map_files/400000-406000
> 23
>
> We are not first who suffer from this problem:
> https://bugzilla.redhat.com/show_bug.cgi?id=711881
> http://marc.info/?l=linux-btrfs&m=130074451403261
> https://bugzilla.openvz.org/show_bug.cgi?id=2653
>
> This bug looks like KABI violation.
>
> And about 2 years ago Mark Fasheh tried to fix this problem:
> http://thr3ads.net/btrfs-devel/2011/05/2346176-RFC-PATCH-0-2-btrfs-vfs-Return-same-device-in-stat-2-and-proc-pid-maps
>
> Eric Biederman sugested to not create a new method and use vfs_getattr,
> but here is a few problems:
> * fanotify doesn't have dentry, but its fdinfo contains device.
> * vfs_getattr can fail and which device should be shown in this case?
> * vfs_getattr gets much more parameters, so here is a question about
>   performance degradation.
>
> So I have a question: Can two inodes from different subvolumes have
> equal inode numbers?
>
> If someone have any suggestions how to fix this problem or any
> explanation why this is not a problem at all, please write here.
>
> Thanks.

  reply	other threads:[~2013-07-05  8:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04  9:51 btrfs: stat(2) and /proc/pid/maps returns different devices Andrew Vagin
2013-07-05  8:06 ` Andrey Wagin [this message]
2013-07-08 21:54 ` David Sterba
2013-07-10 16:31   ` Mark Fasheh
2013-07-10 17:45     ` Mark Fasheh
2013-07-10 22:26       ` David Sterba
2013-07-19 20:51         ` Mark Fasheh
2013-07-31 18:24           ` David Sterba
2013-10-24 10:41           ` Pavel Emelyanov
2013-07-11 21:25       ` Andrew Vagin

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=CANaxB-wvUcs2bKjrJUtKQxojFM86kF-oLwdWcm9d0i2MjHCJ6g@mail.gmail.com \
    --to=avagin@gmail.com \
    --cc=chris.mason@fusionio.com \
    --cc=kzak@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=xemul@openvz.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).