From patchwork Mon Oct 29 19:03:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 990498 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="KFQ1r7jE"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42kPCn0tTWz9sC2 for ; Tue, 30 Oct 2018 06:04:21 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729486AbeJ3DyS (ORCPT ); Mon, 29 Oct 2018 23:54:18 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:45304 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725969AbeJ3DyS (ORCPT ); Mon, 29 Oct 2018 23:54:18 -0400 Received: by mail-qt1-f195.google.com with SMTP id l9-v6so10549845qtj.12; Mon, 29 Oct 2018 12:04:19 -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=4PksShieLrh4Cf0smwQQ0hWXC8t13fGxowZ1fcGZ/Dw=; b=KFQ1r7jEijIFNoNj9v5ejI1tmFigSN8jHtxe09jpQDG0Ha59QFpTveEp2lYzsqBdaU cffse+bmzXcFFxX5zew1dyeKaUIEp6EaF+vs2oIjx7TTPFJaR0nmcer4Dt7C1/WPSFgN SIY+O6z9FNEiJ3g5VA4cJmQ6xJGZMIShqEYKdTA7jnbdWzWpNaPTLQNttBQTHUJrH/li gvQHPxDqnhji2k8qrEXApW1wVB7ydh7jN8v9KhKqUoacxAcDqG4afrx7O7CRKkzVvabV j0e/qm9N5LaAgqITSL1KZBj2A11JbMtmCEP7f8wEmUax+UcoEERl3bNZD/9X/ZBNWGdY xcdg== 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=4PksShieLrh4Cf0smwQQ0hWXC8t13fGxowZ1fcGZ/Dw=; b=D0fKnSY1oyAbxjuD7TUXqPOInRe+Hx5iKirYkd3lZQ9BXVS0E5vuciCiTDmCMGHu9J PEOJTWcEvv4FdafoaC1VCOd8i6/wqREvMx6FvUs7TGz3MzR/GrTrU6zqaYd6X3Bh+Ve3 Ewe0G+4/gREMGA+n4PPFC0Nh6X/a+DvfSj/OrP0liK5NYBjf2bn3PbGMxEUdaeYarA2n vOnpdS314IqtUJ+sbwA6rQnV6G9/7rf3y5xZ7ZlqfWDovSTjJpZVHVjoMUEbkVr2C+yk bAzot4uWtr3IwI4KcZR2DlPm745hPK0vtctnemeb7tt/1fa5YVEaa2RqA6w858LNXfjD CPYw== X-Gm-Message-State: AGRZ1gIaPmQemmyeiEqyYioCVO557bGUBt2qFQc3KzZPvquRQLCZ0mIn 10qWx/+QlOV2oNi4sJaE8ZE= X-Google-Smtp-Source: AJdET5dnpBEG5piJy8oNs2YqED+XaYSQO5YnZLpDncKKCEaNxJNv2aNS/B+7SmSiZNBEzNMxcx5q0w== X-Received: by 2002:ac8:2875:: with SMTP id 50-v6mr13630011qtr.54.1540839859098; Mon, 29 Oct 2018 12:04:19 -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 c5-v6sm2714373qtj.55.2018.10.29.12.04.17 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 29 Oct 2018 12:04:18 -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 v6 09/12] NFS: skip recovery of copy open on dest server Date: Mon, 29 Oct 2018 15:03:54 -0400 Message-Id: <20181029190357.38439-11-olga.kornievskaia@gmail.com> X-Mailer: git-send-email 2.10.1 (Apple Git-78) In-Reply-To: <20181029190357.38439-1-olga.kornievskaia@gmail.com> References: <20181029190357.38439-1-olga.kornievskaia@gmail.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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 9c566a4..482754d 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 0b1dcf9..989f174 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -333,6 +333,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);