All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hubert Kario <hka@qbs.com.pl>
To: dave@jikos.cz
Cc: Liu Bo <liubo2009@cn.fujitsu.com>,
	kreijack@inwind.it, "Matthias G. Eckermann" <mge@suse.com>,
	Alex <alex@bpmit.com>,
	linux-btrfs@vger.kernel.org
Subject: Re: Create subvolume from a directory?
Date: Thu, 03 May 2012 15:26:20 +0200	[thread overview]
Message-ID: <18314084.XgMbhzHaqD@bursa01> (raw)
In-Reply-To: <20120502163337.GH6740@twin.jikos.cz>

[-- Attachment #1: Type: text/plain, Size: 1424 bytes --]

On Wednesday 02 of May 2012 18:33:37 David Sterba wrote:
> On Tue, May 01, 2012 at 07:09:21PM +0200, Hubert Kario wrote:
> > Let me rephrase it:
> > 
> > People don't want to be able to do:
> > 
> > mount /dev/lvm/btrfs /mnt/a -t btrfs -o subvol=volA
> > mount /dev/lvm/btrfs /mnt/b -t btrfs -o subvol=volB
> > cp --reflink=always /mnt/a/file /mnt/b
> > 
> > Just like you can't do hardlinks over `mount --bind` mountpoints, you
> > shouldn't be able to cp reflink over mountpoints. That's expected as this
> > *does* break VFS semantics.
> 
> Proposed fix (incremental on top of the cross-subvol):

I'm a noob as far as kernel development is concerned so take my comments for 
what they're worth.
 
> --- a/fs/btrfs/ioctl.c
> +++ b/fs/btrfs/ioctl.c
> @@ -2321,6 +2321,10 @@ static noinline long btrfs_ioctl_clone(struct file
> *file, unsigned long srcfd, goto out_drop_write;
>         }
> 
> +       ret = -EXDEV;
> +       if (src_file->f_path.mnt != file->f_path.mnt)

I'm not sure about this comparision. Is the f_path struct member used just as 
reference to some general kernel structure?

> +               goto out_fput;
> +
>         src = src_file->f_dentry->d_inode;
> 
>         ret = -EINVAL;

Other that that, looks OK.

Regards,
-- 
Hubert Kario
QBS - Quality Business Software
02-656 Warszawa, ul. Ksawerów 30/85
tel. +48 (22) 646-61-51, 646-74-24
www.qbs.com.pl

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2346 bytes --]

  reply	other threads:[~2012-05-03 13:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-27 17:19 Create subvolume from a directory? Alex
2012-03-27 20:42 ` Chester
2012-03-27 22:24 ` Matthias G. Eckermann
2012-03-28  1:46   ` Fajar A. Nugraha
2012-03-28  9:20     ` David Sterba
2012-03-28  2:18   ` Liu Bo
2012-03-28 16:54     ` Goffredo Baroncelli
2012-03-29  1:24       ` Liu Bo
2012-05-01 17:09         ` Hubert Kario
2012-05-02 16:33           ` David Sterba
2012-05-03 13:26             ` Hubert Kario [this message]
2012-05-14 12:36               ` David Sterba
2012-03-28  9:24 ` David Sterba
2012-03-28 11:11   ` Alex

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=18314084.XgMbhzHaqD@bursa01 \
    --to=hka@qbs.com.pl \
    --cc=alex@bpmit.com \
    --cc=dave@jikos.cz \
    --cc=kreijack@inwind.it \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=liubo2009@cn.fujitsu.com \
    --cc=mge@suse.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 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.