All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olga Kornievskaia <kolga@netapp.com>
To: <Trond.Myklebust@primarydata.com>
Cc: <linux-nfs@vger.kernel.org>
Subject: [RFC v1 17/19] NFS skip recovery of copy open on dest server
Date: Thu, 2 Mar 2017 11:01:21 -0500	[thread overview]
Message-ID: <20170302160123.30375-18-kolga@netapp.com> (raw)
In-Reply-To: <20170302160123.30375-1-kolga@netapp.com>

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 <kolga@netapp.com>
---
 fs/nfs/nfs4_fs.h   |  3 +++
 fs/nfs/nfs4file.c  |  2 +-
 fs/nfs/nfs4state.c | 14 ++++++++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index c23089e..07b93fde 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -161,6 +161,9 @@ enum {
 	NFS_STATE_POSIX_LOCKS,		/* Posix locks are supported */
 	NFS_STATE_RECOVERY_FAILED,	/* OPEN stateid state recovery failed */
 	NFS_STATE_MAY_NOTIFY_LOCK,	/* server may CB_NOTIFY_LOCK */
+#ifdef CONFIG_NFS_V4_2
+	NFS_SRV_SSC_COPY_STATE,		/* ssc state on the dst server */
+#endif /* CONFIG_NFS_V4_2 */
 };
 
 struct nfs4_state {
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 43a2346..f6ccc6f 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -347,7 +347,7 @@ struct file *
 	ctx->state = nfs4_get_open_state(r_ino, sp);
 	if (ctx->state == NULL)
 		goto out_stateowner;
-
+	set_bit(NFS_SRV_SSC_COPY_STATE, &ctx->state->flags);
 	update_open_stateid(ctx->state, stateid, NULL, filep->f_mode);
 
 	nfs_file_set_open_context(filep, ctx);
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 5827d95..af5d8d7 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1501,6 +1501,9 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs
 	struct nfs4_state *state;
 	struct nfs4_lock_state *lock;
 	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)
@@ -1520,6 +1523,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 */
 		atomic_inc(&state->count);
 		spin_unlock(&sp->so_lock);
 		status = ops->recover_open(sp, state);
@@ -1582,6 +1592,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);
-- 
1.8.3.1


  parent reply	other threads:[~2017-03-02 16:34 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 16:01 [RFC v1 00/19] NFS support for inter and async COPY Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 01/19] fs: Don't copy beyond the end of the file Olga Kornievskaia
2017-03-02 16:22   ` Christoph Hellwig
2017-03-02 16:34     ` Olga Kornievskaia
2017-03-03 20:47     ` J. Bruce Fields
2017-03-03 21:08       ` Olga Kornievskaia
2017-03-03 21:32         ` J. Bruce Fields
     [not found]           ` <B3F80DA0-B4F8-4628-88C5-E5C047620F17@netapp.com>
2017-03-04  2:10             ` J. Bruce Fields
2017-03-06 16:27               ` [RFC v1 01/19] " Olga Kornievskaia
2017-03-06 19:09                 ` J. Bruce Fields
2017-03-06 19:23                 ` J. Bruce Fields
2017-03-06 19:23                   ` J. Bruce Fields
2017-03-07 14:18                   ` Olga Kornievskaia
2017-03-07 14:18                     ` Olga Kornievskaia
2017-03-07 14:18                     ` Olga Kornievskaia
2017-03-07 23:40       ` [RFC v1 01/19] fs: " Christoph Hellwig
2017-03-08 17:05         ` J. Bruce Fields
2017-03-08 17:25           ` Christoph Hellwig
2017-03-08 17:32             ` Olga Kornievskaia
2017-03-08 19:53               ` J. Bruce Fields
2017-03-08 20:00                 ` Olga Kornievskaia
2017-03-08 20:00                   ` Olga Kornievskaia
2017-03-08 20:18                   ` J. Bruce Fields
2017-03-08 20:18                   ` Trond Myklebust
2017-03-08 20:18                     ` Trond Myklebust
2017-03-08 20:32                     ` bfields
2017-03-08 20:49                       ` Trond Myklebust
2017-03-08 20:49                         ` Trond Myklebust
2017-03-09 15:29                         ` bfields
2017-03-09 15:35                           ` hch
2017-03-09 16:16                             ` bfields
2017-03-09 16:17                               ` hch
2017-03-09 17:28                                 ` Olga Kornievskaia
2017-03-09 17:28                                   ` Olga Kornievskaia
2017-03-09 18:40                                   ` bfields
2017-03-09 21:55                                   ` hch
2017-03-09 17:35                               ` Olga Kornievskaia
2017-03-09 17:35                                 ` Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 02/19] VFS permit cross device vfs_copy_file_range Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 03/19] VFS don't try clone if superblocks are different Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 04/19] NFS inter ssc open Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 05/19] NFS add COPY_NOTIFY operation Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 06/19] NFS add ca_source_server<> to COPY Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 07/19] NFS CB_OFFLOAD xdr Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 08/19] NFS OFFLOAD_STATUS xdr Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 09/19] NFS OFFLOAD_STATUS op Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 10/19] NFS OFFLOAD_CANCEL xdr Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 11/19] NFS COPY xdr handle async reply Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 12/19] NFS add support for asynchronous COPY Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 13/19] NFS handle COPY reply CB_OFFLOAD call race Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 14/19] NFS send OFFLOAD_CANCEL when COPY killed Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 15/19] NFS make COPY synchronous xdr configurable Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 16/19] NFS handle COPY ERR_OFFLOAD_NO_REQS Olga Kornievskaia
2017-03-02 16:01 ` Olga Kornievskaia [this message]
2017-03-02 16:01 ` [RFC v1 18/19] NFS recover from destination server reboot for copies Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 19/19] NFS if we got partial copy ignore errors Olga Kornievskaia

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=20170302160123.30375-18-kolga@netapp.com \
    --to=kolga@netapp.com \
    --cc=Trond.Myklebust@primarydata.com \
    --cc=linux-nfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.