From patchwork Tue Oct 30 20:56:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 10661551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F1D913E9D for ; Tue, 30 Oct 2018 20:56:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E41692AA38 for ; Tue, 30 Oct 2018 20:56:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D51B02AA3B; Tue, 30 Oct 2018 20:56:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F51D2AA42 for ; Tue, 30 Oct 2018 20:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728055AbeJaFvp (ORCPT ); Wed, 31 Oct 2018 01:51:45 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:38906 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728030AbeJaFvo (ORCPT ); Wed, 31 Oct 2018 01:51:44 -0400 Received: by mail-qt1-f193.google.com with SMTP id v1-v6so11048474qtq.5; Tue, 30 Oct 2018 13:56:40 -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=7UYm6KwHepkUcFRejYDPg8EOERI1MmALOURzx0oOqU8=; b=EYIPGGYUB15cBohrLbQ1H7xRmewHyk12yScSrEhUOIEB8Bdo+5Pt0fSdXUuzIG/6mK yzNkLHK0/1uWcemMFOaYiKvajSvk9IqbbgaqIF9/2xJR3kNZ0ZRmGtWCCG088vq8QBIR eEddIB861PuM6RXm+YJGzv7Gxaol7VNg71077QOUK6KTl/msgFJKjJCimXq/CFHyJ9/W n+/v1R63wBV6Lnk8xR7ViM4kqFC8J49W7vaOm90QkHbbTHuUEMCyj1EQPrLOkN9XeYLP DuMsA2p9O7UdafxPCDNa2SJTq/k+cdTxRLZ9oIYBpFH6CzUbHdWNlGcv8ZujG2GvqGIB aDRw== 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=7UYm6KwHepkUcFRejYDPg8EOERI1MmALOURzx0oOqU8=; b=uZzrrF9ep4rqhZfHCL0ac1+733bk1pCPsKIE5Uka0d78RR31ULeT7TilnPogjyMHMI XO8/4JuYwK1cKuWRGE/hXir0Y7lcUtYv+7P6ybC6J2kKLoOY4812G0lgZ+6vcWGuzSxj Ty9E5g3QNLQl1w4nQ259hivX5LSyuzZy88EDUvrRP59g9lt3iK7zLx/XVZBVKkgx3YHo UUBTt+Rt1QF8YgFooruJljEPNYRsoC0JEbC5Vb0Kw8RBJ+OwWwJHfUy0bVCaNRv83SBh odVJdW3X0gFNbBKWs52r8/lWiNU0GAX0tY/DtxTGiYedpuCCvbaMIUO2V9rNJACF4YgP Xheg== X-Gm-Message-State: AGRZ1gLZ9alUP2v35IUKWuVbqap1GT/kIuav/JKMjcPa2DOpbB8AUzNe YoaVeX2Dae662eumeYg44Mw= X-Google-Smtp-Source: AJdET5cfONjqbSf9Ih1IMfHw0q6IIX43hA16mJ8T1YoolkobyMYHt0c8r44y1h9Xpf07qoxukXbwtQ== X-Received: by 2002:ac8:2249:: with SMTP id p9-v6mr311543qtp.200.1540933000179; Tue, 30 Oct 2018 13:56:40 -0700 (PDT) Received: from Olgas-MBP-195.attlocal.net (172-10-226-31.lightspeed.livnmi.sbcglobal.net. [172.10.226.31]) by smtp.gmail.com with ESMTPSA id i11-v6sm23478157qtc.96.2018.10.30.13.56.37 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 30 Oct 2018 13:56:38 -0700 (PDT) From: Olga Kornievskaia To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, viro@zeniv.linux.org.uk, smfrench@gmail.com, miklos@szeredi.hu Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-man@vger.kernel.org Subject: [PATCH v7 09/11] NFS: for "inter" copy treat ESTALE as ENOTSUPP Date: Tue, 30 Oct 2018 16:56:12 -0400 Message-Id: <20181030205614.40754-11-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.10.1 (Apple Git-78) In-Reply-To: <20181030205614.40754-1-olga.kornievskaia@gmail.com> References: <20181030205614.40754-1-olga.kornievskaia@gmail.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Olga Kornievskaia If the client sends an "inter" copy to the destination server but it only supports "intra" copy, it can return ESTALE (since it doesn't know anything about the file handle from the other server and does not recognize the special case of "inter" copy). Translate this error as ENOTSUPP and also send OFFLOAD_CANCEL to the source server so that it can clean up state. Signed-off-by: Olga Kornievskaia --- fs/nfs/nfs42proc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index 98fe00b..00809b3 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -395,6 +395,11 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src, args.sync = true; dst_exception.retry = 1; continue; + } else if (err == -ESTALE && + !nfs42_files_from_same_server(src, dst)) { + nfs42_do_offload_cancel_async(src, &args.src_stateid); + err = -EOPNOTSUPP; + break; } err2 = nfs4_handle_exception(server, err, &src_exception);