public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Goffredo Baroncelli <kreijack@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: TARUISI Hiroaki <taruishi.hiroak@jp.fujitsu.com>,
	Chris Mason <chris.mason@oracle.com>
Subject: Re: BUG: Link from sub volume, then remove the subvolume -> wrong link
Date: Sat, 12 Dec 2009 14:54:00 +0100	[thread overview]
Message-ID: <200912121454.00871.kreijack@libero.it> (raw)
In-Reply-To: <4B22E2D8.7020706@jp.fujitsu.com>

On Saturday 12 December 2009, TARUISI Hiroaki wrote:
> Hi,
> 
>  I don't know how a hard link becomes to a soft link, hard link
> across subvolumes should not allowed in btrfs.
I try an explanation below

> 
>  Hard link contains target inode number but not target tree.
> So, if we can create such hard link normally, it points to
> a file which has same inode number in same subvolume.

I can add further details. The next boot my machine was un-bootable. The 
reasons was that the *soft link* /lib64 (which pointed to /lib) was wrong.

My explanation of the fact is:
- In my root there was the link "/lib64 -> lib"; the file /lib64 had inode 
number = 257.
- I created a subvolume for my test. Under this subvolume I created a file 
(called "myfile") which (casually) had inode number = 257.
- I hard linked the  file "myfile" (which inode number 257) in my root volume.
- Unfortunately the inode number of the linked file, existed already and was 
the one of the /lib64 link.
- When I removed the subvolume used for my test, the two file (/lib64 and the 
linked target) exchanged its content and the hard-link becames a soft link and 
vice-versa.

The final results was:
- an unbootable machine
- three files with the same inode (and with a ref count equal to two !!)

On the basis of the facts above, I suggest to Chris to raise the importance of 
the patch of TARUISI Hiroaki (see email [PATCH] Deny sys_link across 
subvolumes 12/11/2009).

BR
Goffredo



-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijackATinwind.it>
Key fingerprint = 4769 7E51 5293 D36C 814E  C054 BF04 F161 3DC5 0512

  reply	other threads:[~2009-12-12 13:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-11 19:54 BUG: Link from sub volume, then remove the subvolume -> wrong link Goffredo Baroncelli
2009-12-12  0:24 ` TARUISI Hiroaki
2009-12-12 13:54   ` Goffredo Baroncelli [this message]
2009-12-12 18:39   ` Andy Lutomirski
2009-12-13 23:42     ` TARUISI Hiroaki
2009-12-14 18:43       ` Andrew Lutomirski
2009-12-15  0:15         ` TARUISI Hiroaki
2009-12-15  4:04           ` Andy Lutomirski
2009-12-15 17:31             ` David Nicol
2009-12-17  0:00               ` TARUISI Hiroaki

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=200912121454.00871.kreijack@libero.it \
    --to=kreijack@gmail.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=taruishi.hiroak@jp.fujitsu.com \
    /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