From patchwork Fri Oct 19 15:29:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 10649677 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 BE329181D for ; Fri, 19 Oct 2018 15:29:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABE4627F8E for ; Fri, 19 Oct 2018 15:29:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A009C27F92; Fri, 19 Oct 2018 15:29: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=ham 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 314EE27F8E for ; Fri, 19 Oct 2018 15:29:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727181AbeJSXgR (ORCPT ); Fri, 19 Oct 2018 19:36:17 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:38058 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727265AbeJSXgQ (ORCPT ); Fri, 19 Oct 2018 19:36:16 -0400 Received: by mail-qk1-f195.google.com with SMTP id p3-v6so859472qkb.5 for ; Fri, 19 Oct 2018 08:29:41 -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=jHNYg23wCwnbE2K/p7Cio1KzV7PuntzCYxQsbj/ZduM=; b=I26vCJtt3K4LeCMpG82eo+3KgA607PQu+JlaYnIzkutw7C/UtIVXIIS8Wn6l7SYkrj 1AKHn3XiHiQnPaebshUCv8rrcgos+QQfaKcx3ceoHq4gNwFJo12mzmfnrBqeLbVaCjUr EtmHc4hWaIL0DU78NaRd4zXDuBefFa7wwsb15BKVeObmLgBDFkfqzFDLYueuKcQVLYot Q8MeFgbl93D15s6gwjeVwg2q+3VmaFqKoMaCDCiSENan1B6Tc3+p+Sv42TKAWD7fOwEA m/yFCIR7W/dyMMyko7DvHsfYuqac7eq4oooFIjPXuuRNnX3BbBmnSXWDI2Prt7jLt5PU C0Cw== 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=jHNYg23wCwnbE2K/p7Cio1KzV7PuntzCYxQsbj/ZduM=; b=spZ9omIi153YeWHiDd4HNssm8L4c+KKEjCoon8PVDNDfWIfo4kUGKUzEwRBT+P5+8M TxfW/ZGo8WIcY7tS9JJ2cVW0N0+umJbFtKbsJe6Kb4/0h60X7wGT+dDqoa82r/AmzH4+ gjngfE7HDkI6uybqiDsDmJapm5HcVOcGWPho9YZgRX0cQOSJgZJkZFB69mGsx/VnyN62 wbmOMduHdGPfV+i/fOEoXC0tV9Bny5AsWzOYRImeBtXbe5NIBB27goc/3iDtqjd3GA/L dYcaCCmh3X8X6JMsx7F0R/e+Kl80r01vF5WhmayvDUbLeGanSXMoENemoA/V4xH3YsRy s6Jw== X-Gm-Message-State: ABuFfogIZ5+hfEiT3Sj8QSJ39bWyLpRUD7x4C2jD26I2+kVscZzRgadK /CtX7lbRNmm6V0SUz4gnTgs= X-Google-Smtp-Source: ACcGV60M2Z903JKzUuUUIxYilWYGqD6QJ+DLV3iP3E67zetf9Q+sMtuaB6iWGFyeat7XH4znuOKUFg== X-Received: by 2002:a37:4a96:: with SMTP id x144-v6mr34272080qka.112.1539962981387; Fri, 19 Oct 2018 08:29:41 -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 w39-v6sm17358099qtc.84.2018.10.19.08.29.40 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 19 Oct 2018 08:29:40 -0700 (PDT) From: Olga Kornievskaia To: trondmy@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v1 09/11] NFS skip recovery of copy open on dest server Date: Fri, 19 Oct 2018 11:29:30 -0400 Message-Id: <20181019152932.32462-10-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.10.1 (Apple Git-78) In-Reply-To: <20181019152932.32462-1-olga.kornievskaia@gmail.com> References: <20181019152932.32462-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 Mark the open created for the source file on the destination server. Then if this open is going thru a recovery, then fail the recovery as we don't need to be recoving a "fake" open. We need to fail the ongoing READs and vfs_copy_file_range(). Signed-off-by: Olga Kornievskaia --- fs/nfs/nfs4_fs.h | 1 + fs/nfs/nfs4file.c | 1 + fs/nfs/nfs4state.c | 14 ++++++++++++++ 3 files changed, 16 insertions(+) diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index f229864..8b00c90 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -165,6 +165,7 @@ enum { NFS_STATE_CHANGE_WAIT, /* A state changing operation is outstanding */ #ifdef CONFIG_NFS_V4_2 NFS_CLNT_DST_SSC_COPY_STATE, /* dst server open state on client*/ + NFS_SRV_SSC_COPY_STATE, /* ssc state on the dst server */ #endif /* CONFIG_NFS_V4_2 */ }; diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 7f226f4..6cc4ae4 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -331,6 +331,7 @@ struct file * if (ctx->state == NULL) goto out_stateowner; + set_bit(NFS_SRV_SSC_COPY_STATE, &ctx->state->flags); set_bit(NFS_OPEN_STATE, &ctx->state->flags); memcpy(&ctx->state->open_stateid.other, &stateid->other, NFS4_STATEID_OTHER_SIZE); diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 62ae0fd..b0b82c6 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1606,6 +1606,9 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs { struct nfs4_state *state; int status = 0; +#ifdef CONFIG_NFS_V4_2 + bool found_ssc_copy_state = false; +#endif /* CONFIG_NFS_V4_2 */ /* Note: we rely on the sp->so_states list being ordered * so that we always reclaim open(O_RDWR) and/or open(O_WRITE) @@ -1625,6 +1628,13 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs continue; if (state->state == 0) continue; +#ifdef CONFIG_NFS_V4_2 + if (test_bit(NFS_SRV_SSC_COPY_STATE, &state->flags)) { + nfs4_state_mark_recovery_failed(state, -EIO); + found_ssc_copy_state = true; + continue; + } +#endif /* CONFIG_NFS_V4_2 */ refcount_inc(&state->count); spin_unlock(&sp->so_lock); status = __nfs4_reclaim_open_state(sp, state, ops); @@ -1671,6 +1681,10 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs } raw_write_seqcount_end(&sp->so_reclaim_seqcount); spin_unlock(&sp->so_lock); +#ifdef CONFIG_NFS_V4_2 + if (found_ssc_copy_state) + return -EIO; +#endif /* CONFIG_NFS_V4_2 */ return 0; out_err: nfs4_put_open_state(state);