All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] Recover from stateid-type error on SETATTR
@ 2015-06-12 18:30 Olga Kornievskaia
  2015-06-12 18:37 ` Trond Myklebust
  0 siblings, 1 reply; 13+ messages in thread
From: Olga Kornievskaia @ 2015-06-12 18:30 UTC (permalink / raw)
  To: Anna.Schumaker; +Cc: linux-nfs

Client can receives stateid-type error (eg., BAD_STATEID) on SETATTR when
delegation stateid was used. When no open state exists, in case of application
calling truncate() on the file, client has no state to recover and fails with
EIO.

Instead, upon such error, return the bad delegation and then resend the
SETATTR with a zero stateid.

Signed-off: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfs/delegation.h | 6 ++++++
 fs/nfs/nfs4proc.c   | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h
index e3c20a3..e37165f 100644
--- a/fs/nfs/delegation.h
+++ b/fs/nfs/delegation.h
@@ -62,6 +62,12 @@ void nfs_mark_delegation_referenced(struct nfs_delegation *delegation);
 int nfs4_have_delegation(struct inode *inode, fmode_t flags);
 int nfs4_check_delegation(struct inode *inode, fmode_t flags);
 
+static inline int nfs4_have_any_delegation(struct inode *inode)
+{
+	struct nfs_inode *nfsi = NFS_I(inode);
+	return rcu_access_pointer(nfsi->delegation) ? 1 : 0;
+}
+
 #endif
 
 static inline int nfs_have_delegated_attributes(struct inode *inode)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index ad7cf7e..63b3581 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -360,8 +360,13 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc
 		case -NFS4ERR_DELEG_REVOKED:
 		case -NFS4ERR_ADMIN_REVOKED:
 		case -NFS4ERR_BAD_STATEID:
-			if (state == NULL)
+			if (state == NULL) {
+				if (nfs4_have_any_delegation(inode)) {
+					nfs4_inode_return_delegation(inode);
+					exception->retry = 1;
+				}
 				break;
+			}
 			ret = nfs4_schedule_stateid_recovery(server, state);
 			if (ret < 0)
 				break;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread
* [PATCH 1/1] Recover from stateid-type error on SETATTR
@ 2015-06-12 20:53 Olga Kornievskaia
  2015-06-12 21:21 ` Trond Myklebust
  0 siblings, 1 reply; 13+ messages in thread
From: Olga Kornievskaia @ 2015-06-12 20:53 UTC (permalink / raw)
  To: Anna.Schumaker; +Cc: linux-nfs

Client can receives stateid-type error (eg., BAD_STATEID) on SETATTR when
delegation stateid was used. When no open state exists, in case of application
calling truncate() on the file, client has no state to recover and fails with
EIO.

Instead, upon such error, return the bad delegation and then resend the
SETATTR with a zero stateid.

Signed-off: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfs/nfs4proc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index ad7cf7e..2a85af3 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -360,8 +360,14 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc
 		case -NFS4ERR_DELEG_REVOKED:
 		case -NFS4ERR_ADMIN_REVOKED:
 		case -NFS4ERR_BAD_STATEID:
-			if (state == NULL)
+			if (state == NULL) {
+				if (inode && nfs4_have_delegation(inode, 
+						FMODE_READ)) {
+					nfs4_inode_return_delegation(inode);
+					exception->retry = 1;
+				}
 				break;
+			}
 			ret = nfs4_schedule_stateid_recovery(server, state);
 			if (ret < 0)
 				break;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread
* [PATCH 1/1] Recover from stateid-type error on SETATTR
@ 2015-04-21 22:36 Olga Kornievskaia
  2015-04-27 17:48 ` Olga Kornievskaia
  0 siblings, 1 reply; 13+ messages in thread
From: Olga Kornievskaia @ 2015-04-21 22:36 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs

Client can receives stateid-type error (eg., BAD_STATEID) on SETATTR
when delegation stateid was used. When no open state exists, in case
of application calling truncate() on the file, client has no state to
recover and fails with EIO.

Instead, upon such error, return the bad delegation and then resend the
SETATTR with a zero stateid. In general, when something calls
nfs4_handle_exception() with a null state, the operation should be
retried after bad delegation is removed.

Signed-off: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfs/nfs4proc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index ad7cf7e..fbde292 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -360,8 +360,11 @@ static int nfs4_handle_exception(struct
nfs_server *server, int errorcode, struc
         case -NFS4ERR_DELEG_REVOKED:
         case -NFS4ERR_ADMIN_REVOKED:
         case -NFS4ERR_BAD_STATEID:
-            if (state == NULL)
+            if (state == NULL) {
+                nfs4_inode_return_delegation(inode);
+                exception->retry = 1;
                 break;
+            }
             ret = nfs4_schedule_stateid_recovery(server, state);
             if (ret < 0)
                 break;
--

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-06-15 16:05 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-12 18:30 [PATCH 1/1] Recover from stateid-type error on SETATTR Olga Kornievskaia
2015-06-12 18:37 ` Trond Myklebust
2015-06-12 18:48   ` Kornievskaia, Olga
2015-06-12 20:02     ` Trond Myklebust
2015-06-12 18:56   ` Anna Schumaker
  -- strict thread matches above, loose matches on Subject: below --
2015-06-12 20:53 Olga Kornievskaia
2015-06-12 21:21 ` Trond Myklebust
2015-06-12 21:37   ` Kornievskaia, Olga
2015-06-12 21:42     ` Trond Myklebust
2015-06-15 16:03       ` Kornievskaia, Olga
2015-04-21 22:36 Olga Kornievskaia
2015-04-27 17:48 ` Olga Kornievskaia
2015-05-04 16:24   ` Olga Kornievskaia

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.