Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: David Disseldorp <ddiss-l3A5Bk7waGM@public.gmane.org>
To: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: samba-technical
	<samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org>,
	"linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Mohammad Samian Yusuf
	<s.yusuf91-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>
Subject: Re: Samba server bug: CopyChunk from one share to a different share on same server
Date: Mon, 9 Nov 2015 13:46:13 +0100	[thread overview]
Message-ID: <20151109134613.4ae8148c@plati> (raw)
In-Reply-To: <CAH2r5mvf87XmR_VwiHa6B0LV0WDRb8Ro=cRzQbUDV-9yHAjW3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Sun, 8 Nov 2015 20:52:16 -0600, Steve French wrote:

> Tried a quick experiment using cloner (David's tool - xfstests/src/cloner)
> to copy a file from share1 to share2 on the same target server (using
> CopyChunk and SMB3).  Works fine for Windows (tried Windows 8.1) but failed
> for Samba 4.2.
> 
> This is one of the more important cases to support (copying a file from one
> share to another)
> 
> Samba returns STATUS_OBJECT_NAME_NOT_FOUND on FSCTL_SRV_COPYCHUNK_WRITE
> unless source and target are on the same share.  I didn't try it with
> vfs_btrfs (the test system was running ext4, and both exports are on the
> same volume on the server).

It's no different across Samba VFS modules - this behaviour is intended.
The persistent/volatile handle is used to generate the copy-chunk resume
key. file_fsp_get() is currently used to lookup the source fsp using the
destination file connection context.

> Was testing the change below where I relax the copy offload check as
> follows (to allow cross share copy chunk as Windows does)
> 
> diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
> index 28a77bf..35cf990 100644
> --- a/fs/cifs/ioctl.c
> +++ b/fs/cifs/ioctl.c
> @@ -85,9 +85,14 @@ static long cifs_ioctl_clone(unsigned int xid, struct
> file *dst_file,
>      src_tcon = tlink_tcon(smb_file_src->tlink);
>      target_tcon = tlink_tcon(smb_file_target->tlink);
> 
> -    /* check if source and target are on same tree connection */
> -    if (src_tcon != target_tcon) {
> -        cifs_dbg(VFS, "file copy src and target on different volume\n");
> +    /* check source and target on same server (or volume if dup_extents) */
> +    if (dup_extents && (src_tcon != target_tcon)) {
> +        cifs_dbg(VFS, "source and target of copy not on same share\n");
> +        goto out_fput;
> +    }
> +
> +    if (!dup_extents && (src_tcon->ses != target_tcon->ses)) {
> +        cifs_dbg(VFS, "source and target of copy not on same server\n");
>          goto out_fput;
>      }
> 
> 

This change looks fine to me.
Reviewed-by: David Disseldorp <ddiss-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>

Cheers, David

  parent reply	other threads:[~2015-11-09 12:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09  2:52 Samba server bug: CopyChunk from one share to a different share on same server Steve French
     [not found] ` <CAH2r5mvf87XmR_VwiHa6B0LV0WDRb8Ro=cRzQbUDV-9yHAjW3A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-09 12:46   ` David Disseldorp [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-11-09  3:03 Steve French
2015-11-09  3:04 Steve French

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=20151109134613.4ae8148c@plati \
    --to=ddiss-l3a5bk7wagm@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=s.yusuf91-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org \
    --cc=samba-technical-w/Ol4Ecudpl8XjKLYN78aQ@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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