public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@primarydata.com>
To: anna.schumaker@netapp.com
Cc: linux-nfs@vger.kernel.org, Oleg Drokin <green@linuxhacker.ru>
Subject: [PATCH v6 21/29] NFSv4: Pass the stateid to the exception handler in nfs4_read/write_done_cb
Date: Tue, 20 Sep 2016 12:56:03 -0400	[thread overview]
Message-ID: <1474390571-17106-22-git-send-email-trond.myklebust@primarydata.com> (raw)
In-Reply-To: <1474390571-17106-21-git-send-email-trond.myklebust@primarydata.com>

The actual stateid used in the READ or WRITE can represent a delegation,
a lock or a stateid, so it is useful to pass it as an argument to the
exception handler when an expired/revoked response is received from the
server. It also ensures that we don't re-label the state as needing
recovery if that has already occurred.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
---
 fs/nfs/nfs4proc.c | 35 +++++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index e5b35e57a8ff..1ddfb300addf 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4523,11 +4523,18 @@ static int nfs4_read_done_cb(struct rpc_task *task, struct nfs_pgio_header *hdr)
 	struct nfs_server *server = NFS_SERVER(hdr->inode);
 
 	trace_nfs4_read(hdr, task->tk_status);
-	if (nfs4_async_handle_error(task, server,
-				    hdr->args.context->state,
-				    NULL) == -EAGAIN) {
-		rpc_restart_call_prepare(task);
-		return -EAGAIN;
+	if (task->tk_status < 0) {
+		struct nfs4_exception exception = {
+			.inode = hdr->inode,
+			.state = hdr->args.context->state,
+			.stateid = &hdr->args.stateid,
+		};
+		task->tk_status = nfs4_async_handle_exception(task,
+				server, task->tk_status, &exception);
+		if (exception.retry) {
+			rpc_restart_call_prepare(task);
+			return -EAGAIN;
+		}
 	}
 
 	__nfs4_read_done_cb(hdr);
@@ -4596,11 +4603,19 @@ static int nfs4_write_done_cb(struct rpc_task *task,
 	struct inode *inode = hdr->inode;
 
 	trace_nfs4_write(hdr, task->tk_status);
-	if (nfs4_async_handle_error(task, NFS_SERVER(inode),
-				    hdr->args.context->state,
-				    NULL) == -EAGAIN) {
-		rpc_restart_call_prepare(task);
-		return -EAGAIN;
+	if (task->tk_status < 0) {
+		struct nfs4_exception exception = {
+			.inode = hdr->inode,
+			.state = hdr->args.context->state,
+			.stateid = &hdr->args.stateid,
+		};
+		task->tk_status = nfs4_async_handle_exception(task,
+				NFS_SERVER(inode), task->tk_status,
+				&exception);
+		if (exception.retry) {
+			rpc_restart_call_prepare(task);
+			return -EAGAIN;
+		}
 	}
 	if (task->tk_status >= 0) {
 		renew_lease(NFS_SERVER(inode), hdr->timestamp);
-- 
2.7.4


  reply	other threads:[~2016-09-20 16:56 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-20 16:55 [PATCH v6 00/29] Fix delegation behaviour when server revokes some state Trond Myklebust
2016-09-20 16:55 ` [PATCH v6 01/29] NFSv4.1: Don't deadlock the state manager on the SEQUENCE status flags Trond Myklebust
2016-09-20 16:55   ` [PATCH v6 02/29] NFS: Fix inode corruption in nfs_prime_dcache() Trond Myklebust
2016-09-20 16:55     ` [PATCH v6 03/29] NFSv4: Don't report revoked delegations as valid in nfs_have_delegation() Trond Myklebust
2016-09-20 16:55       ` [PATCH v6 04/29] NFSv4: nfs4_copy_delegation_stateid() must fail if the delegation is invalid Trond Myklebust
2016-09-20 16:55         ` [PATCH v6 05/29] NFSv4.1: Don't check delegations that are already marked as revoked Trond Myklebust
2016-09-20 16:55           ` [PATCH v6 06/29] NFSv4.1: Allow test_stateid to handle session errors without waiting Trond Myklebust
2016-09-20 16:55             ` [PATCH v6 07/29] NFSv4.1: Add a helper function to deal with expired stateids Trond Myklebust
2016-09-20 16:55               ` [PATCH v6 08/29] NFSv4.x: Allow callers of nfs_remove_bad_delegation() to specify a stateid Trond Myklebust
2016-09-20 16:55                 ` [PATCH v6 09/29] NFSv4.1: Test delegation stateids when server declares "some state revoked" Trond Myklebust
2016-09-20 16:55                   ` [PATCH v6 10/29] NFSv4.1: Deal with server reboots during delegation expiration recovery Trond Myklebust
2016-09-20 16:55                     ` [PATCH v6 11/29] NFSv4.1: Don't recheck delegations that have already been checked Trond Myklebust
2016-09-20 16:55                       ` [PATCH v6 12/29] NFSv4.1: Allow revoked stateids to skip the call to TEST_STATEID Trond Myklebust
2016-09-20 16:55                         ` [PATCH v6 13/29] NFSv4.1: Ensure we always run TEST/FREE_STATEID on locks Trond Myklebust
2016-09-20 16:55                           ` [PATCH v6 14/29] NFSv4.1: FREE_STATEID can be asynchronous Trond Myklebust
2016-09-20 16:55                             ` [PATCH v6 15/29] NFSv4.1: Ensure we call FREE_STATEID if needed on close/delegreturn/locku Trond Myklebust
2016-09-20 16:55                               ` [PATCH v6 16/29] NFSv4: Ensure we don't re-test revoked and freed stateids Trond Myklebust
2016-09-20 16:55                                 ` [PATCH v6 17/29] NFSv4: nfs_inode_find_delegation_state_and_recover() should check all stateids Trond Myklebust
2016-09-20 16:56                                   ` [PATCH v6 18/29] NFSv4: nfs4_handle_delegation_recall_error() handle expiration as revoke case Trond Myklebust
2016-09-20 16:56                                     ` [PATCH v6 19/29] NFSv4: nfs4_handle_setlk_error() " Trond Myklebust
2016-09-20 16:56                                       ` [PATCH v6 20/29] NFSv4.1: nfs4_layoutget_handle_exception handle revoked state Trond Myklebust
2016-09-20 16:56                                         ` Trond Myklebust [this message]
2016-09-20 16:56                                           ` [PATCH v6 22/29] NFSv4: Fix a race in nfs_inode_reclaim_delegation() Trond Myklebust
2016-09-20 16:56                                             ` [PATCH v6 23/29] NFSv4: Fix a race when updating an open_stateid Trond Myklebust
2016-09-20 16:56                                               ` [PATCH v6 24/29] NFS: Always call nfs_inode_find_state_and_recover() when revoking a delegation Trond Myklebust
2016-09-20 16:56                                                 ` [PATCH v6 25/29] NFSv4: nfs4_do_handle_exception() handle revoke/expiry of a single stateid Trond Myklebust
2016-09-20 16:56                                                   ` [PATCH v6 26/29] NFSv4: Don't test open_stateid unless it is set Trond Myklebust
2016-09-20 16:56                                                     ` [PATCH v6 27/29] NFSv4: Mark the lock and open stateids as invalid after freeing them Trond Myklebust
2016-09-20 16:56                                                       ` [PATCH v6 28/29] NFSv4: Open state recovery must account for file permission changes Trond Myklebust
2016-09-20 16:56                                                         ` [PATCH v6 29/29] NFSv4: Fix retry issues with nfs41_test/free_stateid Trond Myklebust
2016-09-21 16:03                         ` [PATCH v6 12/29] NFSv4.1: Allow revoked stateids to skip the call to TEST_STATEID Anna Schumaker
2016-09-21 16:39                           ` Trond Myklebust
2016-09-20 22:06 ` [PATCH v6 00/29] Fix delegation behaviour when server revokes some state Oleg Drokin
     [not found]   ` <104E1824-0235-41DF-AA9D-5C3F5560CA57@primarydata.com>
2016-09-21  1:07     ` Oleg Drokin

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=1474390571-17106-22-git-send-email-trond.myklebust@primarydata.com \
    --to=trond.myklebust@primarydata.com \
    --cc=anna.schumaker@netapp.com \
    --cc=green@linuxhacker.ru \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox