Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2199334ybe; Sat, 7 Sep 2019 10:43:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqydr84y1/nQ5gof+Q28oOEmydQpcoS1qsd91FDMFIrVnkK16qHS1K6Lw7fQMZbNY23MwaxK X-Received: by 2002:a63:5c06:: with SMTP id q6mr13679423pgb.45.1567878225676; Sat, 07 Sep 2019 10:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567878225; cv=none; d=google.com; s=arc-20160816; b=TYO+6baR+/MNX2ZAXde7xS7rZF8Io/sQ1wZiXC2QPAN5kGt6xA1f4w5+KmqTYC09qD PFn3Pezd2BtfUvBggTXQf0XRhC88E7s0noemjLMipf7p1HzHiExJHoEoDUugqMWKRcir nSBYA6GnMdRDWXJRflH1IqxAgp/9IScYoYyge7L51c2V/7Dk6t79psQFZj2r8goC3Jc2 ZQTl+p2lI/akU73/syu82WbosScGBd3eualp4gyHz6gCVK4093rQHL+n8+7W7uiM2/L9 aHN8XNTf1QQBPRZLDc3Psg8RLioZmkhdeT6kO6JpZH7vQs4LUPgu2+6nd+UGBKuBCJsJ fDow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Obq2s/I8IROUITybj5QBlF9nrcnOtRzdlJGuACz59bo=; b=JS97RQjFM1NR4S5ypCUH1vzWtafUa2RsLRQsWW1+OIHGKkVqCpuaQWEoja3mzK4YLB 6Gsw8dUBZjqP5ISCUnWwFz5QfifbvGWmIxGYzc/JnLI3/3HUV2fa+XFE1IF4jQ/s2+6F meGmoPB8nJoHiri1g8QUdxKr9pr4d+bN24+QBf+1wNk7Q+c3ESIVyXipi4zDP4JcAeHJ PolL4qsx1y4MgYv3+2fT8UB1ITbTcAd3wjTCJ3nRkM3RKrMsyJwsDv9ZaoEE7rw9RMbD L5T4/9kHvjmJk3rwW72dR5taAauWXYQw6UGPIR4QeIP6p6hgRAEMVkSHnVVqsWsED7uE fRmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LsG6kqRB; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si7652156pgu.549.2019.09.07.10.43.32; Sat, 07 Sep 2019 10:43:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LsG6kqRB; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392248AbfIFTqi (ORCPT + 99 others); Fri, 6 Sep 2019 15:46:38 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:35821 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392221AbfIFTqi (ORCPT ); Fri, 6 Sep 2019 15:46:38 -0400 Received: by mail-io1-f67.google.com with SMTP id f4so14693069ion.2 for ; Fri, 06 Sep 2019 12:46:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Obq2s/I8IROUITybj5QBlF9nrcnOtRzdlJGuACz59bo=; b=LsG6kqRBQYXTc2rxg7IZT3xEqd42N6NIED7R96KN77UWrZ+yj7POfAY5lI0Gzlxqk3 5Or0GBZCyR6Dddwsm4SnI+l3u/aKZA4TBPiuaVddv9aZ1/se/ZOc8tpVxChCAzuWVOP3 5rh/F/0ebauJKkHxIDFuhjpKQ3mgVgnynnaK9lkx931q2jJi7w5G2Z5k5zVIj8hWsUbs vhs+QsMglk8at6K2wTEoHGmzdRvdRaSK9iUTDAh/OV5ZXGxD3gjDiiJwnX3s7121L9tc xjr1DVTWnV8IeU6n3D2UKwFnCe+2Kx9mAg4xpjPJNvyuzdcDB8LWBYmm/4CnXhOIqpMr KB3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Obq2s/I8IROUITybj5QBlF9nrcnOtRzdlJGuACz59bo=; b=eV+dN1uzvY3okwX5Q2d9boKfqrRoWHXavMrHDCceQJFP8TXX8AYW/hix6xWxbquFmI 1yXdhsm9JKfw9PdQla/eKyGtADp8oWw6kTnGD2NDOerPzBy+vY1ejsDw+mJyO+eP5+wB oCstSwLPyHrOP9UhPbbgYVJs5vKYoo63Sc8n6TD5Ztif0BEXSi5HSeyjouTacxIT+Ggw O3Ve1xIcfHwM5ylj0XBb0LwcGZlyIzMU4DDdM9gRLhx4gytwbzfgrzOmZaJXBrarauQ4 XWrx9CTKbVpMQ9PZ+u3R/aI3SNVF7VF4TyVJT6efB/KQnAJdgHGtalvyEb6qj8SeJeud jJvw== X-Gm-Message-State: APjAAAU3ziT/wluk8xTLYcERxZlatKPT/11tHjkGmZZf3uw2VNYGZjK5 omINeaPq+cBPJRv6zOgx4Z4= X-Received: by 2002:a02:a909:: with SMTP id n9mr11570477jam.57.1567799197098; Fri, 06 Sep 2019 12:46:37 -0700 (PDT) Received: from Olgas-MBP-201.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id i14sm5118085ioi.47.2019.09.06.12.46.36 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 06 Sep 2019 12:46:36 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, bfields@redhat.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v6 03/19] NFS: add ca_source_server<> to COPY Date: Fri, 6 Sep 2019 15:46:15 -0400 Message-Id: <20190906194631.3216-4-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.10.1 (Apple Git-78) In-Reply-To: <20190906194631.3216-1-olga.kornievskaia@gmail.com> References: <20190906194631.3216-1-olga.kornievskaia@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Olga Kornievskaia Support only one source server address: the same address that the client and source server use. Signed-off-by: Andy Adamson Signed-off-by: Olga Kornievskaia --- fs/nfs/nfs42.h | 3 ++- fs/nfs/nfs42proc.c | 26 +++++++++++++++++--------- fs/nfs/nfs42xdr.c | 12 ++++++++++-- fs/nfs/nfs4file.c | 7 ++++++- include/linux/nfs_xdr.h | 1 + 5 files changed, 36 insertions(+), 13 deletions(-) diff --git a/fs/nfs/nfs42.h b/fs/nfs/nfs42.h index 4995731..02e3810 100644 --- a/fs/nfs/nfs42.h +++ b/fs/nfs/nfs42.h @@ -15,7 +15,8 @@ /* nfs4.2proc.c */ #ifdef CONFIG_NFS_V4_2 int nfs42_proc_allocate(struct file *, loff_t, loff_t); -ssize_t nfs42_proc_copy(struct file *, loff_t, struct file *, loff_t, size_t); +ssize_t nfs42_proc_copy(struct file *, loff_t, struct file *, loff_t, size_t, + struct nl4_server *, nfs4_stateid *); int nfs42_proc_deallocate(struct file *, loff_t, loff_t); loff_t nfs42_proc_llseek(struct file *, loff_t, int); int nfs42_proc_layoutstats_generic(struct nfs_server *, diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index 6317dd8..e34ade8 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -243,7 +243,9 @@ static ssize_t _nfs42_proc_copy(struct file *src, struct file *dst, struct nfs_lock_context *dst_lock, struct nfs42_copy_args *args, - struct nfs42_copy_res *res) + struct nfs42_copy_res *res, + struct nl4_server *nss, + nfs4_stateid *cnr_stateid) { struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COPY], @@ -257,11 +259,15 @@ static ssize_t _nfs42_proc_copy(struct file *src, size_t count = args->count; ssize_t status; - status = nfs4_set_rw_stateid(&args->src_stateid, src_lock->open_context, - src_lock, FMODE_READ); - if (status) - return status; - + if (nss) { + args->cp_src = nss; + nfs4_stateid_copy(&args->src_stateid, cnr_stateid); + } else { + status = nfs4_set_rw_stateid(&args->src_stateid, + src_lock->open_context, src_lock, FMODE_READ); + if (status) + return status; + } status = nfs_filemap_write_and_wait_range(file_inode(src)->i_mapping, pos_src, pos_src + (loff_t)count - 1); if (status) @@ -325,8 +331,9 @@ static ssize_t _nfs42_proc_copy(struct file *src, } ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src, - struct file *dst, loff_t pos_dst, - size_t count) + struct file *dst, loff_t pos_dst, size_t count, + struct nl4_server *nss, + nfs4_stateid *cnr_stateid) { struct nfs_server *server = NFS_SERVER(file_inode(dst)); struct nfs_lock_context *src_lock; @@ -368,7 +375,8 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src, inode_lock(file_inode(dst)); err = _nfs42_proc_copy(src, src_lock, dst, dst_lock, - &args, &res); + &args, &res, + nss, cnr_stateid); inode_unlock(file_inode(dst)); if (err >= 0) diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c index ccabc0c..c03f324 100644 --- a/fs/nfs/nfs42xdr.c +++ b/fs/nfs/nfs42xdr.c @@ -21,7 +21,10 @@ #define encode_copy_maxsz (op_encode_hdr_maxsz + \ XDR_QUADLEN(NFS4_STATEID_SIZE) + \ XDR_QUADLEN(NFS4_STATEID_SIZE) + \ - 2 + 2 + 2 + 1 + 1 + 1) + 2 + 2 + 2 + 1 + 1 + 1 +\ + 1 + /* One cnr_source_server */\ + 1 + /* nl4_type */ \ + 1 + XDR_QUADLEN(NFS4_OPAQUE_LIMIT)) #define decode_copy_maxsz (op_decode_hdr_maxsz + \ NFS42_WRITE_RES_SIZE + \ 1 /* cr_consecutive */ + \ @@ -216,7 +219,12 @@ static void encode_copy(struct xdr_stream *xdr, encode_uint32(xdr, 1); /* consecutive = true */ encode_uint32(xdr, args->sync); - encode_uint32(xdr, 0); /* src server list */ + if (args->cp_src == NULL) { /* intra-ssc */ + encode_uint32(xdr, 0); /* no src server list */ + return; + } + encode_uint32(xdr, 1); /* supporting 1 server */ + encode_nl4_server(xdr, args->cp_src); } static void encode_offload_cancel(struct xdr_stream *xdr, diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 686a6c4..b68b41b 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -134,6 +134,8 @@ static ssize_t __nfs4_copy_file_range(struct file *file_in, loff_t pos_in, size_t count, unsigned int flags) { struct nfs42_copy_notify_res *cn_resp = NULL; + struct nl4_server *nss = NULL; + nfs4_stateid *cnrs = NULL; ssize_t ret; /* Only offload copy if superblock is the same */ @@ -154,8 +156,11 @@ static ssize_t __nfs4_copy_file_range(struct file *file_in, loff_t pos_in, ret = -EOPNOTSUPP; goto out; } + nss = &cn_resp->cnr_src; + cnrs = &cn_resp->cnr_stateid; } - ret = nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count); + ret = nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count, + nss, cnrs); out: kfree(cn_resp); return ret; diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 0a7af40..008faca 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1435,6 +1435,7 @@ struct nfs42_copy_args { u64 count; bool sync; + struct nl4_server *cp_src; }; struct nfs42_write_res { -- 1.8.3.1