Skip to contentSkip to conversation

NFSv4.0 reclaim reboot state when re-establishing clientid

PATCH In review [email protected] 3 participants 4 messages Sep 28, 2012 – Oct 1, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover NFSv4.0 reclaim reboot state when re-establishing clientid

From: Andy Adamson <[email protected]>

This patch fixes an infinite loop where a file is open during a reboot, and written to after the reboot. NFS4ERR_BADSESSION is intially returned, and first the session, and then the clientid are re-established. But since the open state was not recovered, the write after reboot would use the old stateid. The server then returns NFS4ERR_STALE_STATEID as it should, and the client then goes into the NFS4CLNT_CHECK_LEASE state which sends a solo sequence operation to check the lease. Since the clientid/session has been re-established, the NFS4CLNT_CHECK_LEASE does not receive an error, and the write is resent with the old stateid.....

-->Andy

Andy Adamson (1):
NFSv4.0 reclaim reboot state when re-establishing clientid

 fs/nfs/nfs4state.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 1/1 NFSv4.0 reclaim reboot state when re-establishing clientid

From: Andy Adamson <[email protected]>

We should always reclaim state when the lease and therefore the clientid is expired.

---
 fs/nfs/nfs4state.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
fs/nfs/nfs4state.c +4 -2
index a5331ec..134323a 100644
@@ -1600,8 +1600,8 @@ out:
 	return nfs4_recovery_handle_error(clp, status);
 }
 
-/* Set NFS4CLNT_LEASE_EXPIRED for all v4.0 errors and for recoverable errors
- * on EXCHANGE_ID for v4.1
+/* Set NFS4CLNT_LEASE_EXPIRED and reclaim reboot state for all v4.0 errors
+ * and for recoverable errors on EXCHANGE_ID for v4.1
  */
 static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status)
 {
@@ -1647,6 +1647,8 @@ static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status)
 		return status;
 	}
 	set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
+	nfs4_state_clear_reclaim_reboot(clp);
+	nfs4_state_start_reclaim_reboot(clp);
 	dprintk("%s: handled error %d for server %s\n", __func__, status,
 			clp->cl_hostname);
 	return 0;
Signature · 1 line
1.7.7.6
#2 lore raw

T24gRnJpLCAyMDEyLTA5LTI4IGF0IDE3OjA1IC0wNDAwLCBhbmRyb3NAbmV0YXBwLmNvbSB3cm90 ZToNCj4gRnJvbTogQW5keSBBZGFtc29uIDxhbmRyb3NAbmV0YXBwLmNvbT4NCj4gDQo+IFdlIHNo b3VsZCBhbHdheXMgcmVjbGFpbSBzdGF0ZSB3aGVuIHRoZSBsZWFzZSBhbmQgdGhlcmVmb3JlIHRo ZSBjbGllbnRpZA0KPiBpcyBleHBpcmVkLg0KPiANCj4gU2lnbmVkLW9mZi1ieTogQW5keSBBZGFt c29uIDxhbmRyb3NAbmV0YXBwLmNvbT4NCj4gLS0tDQo+ICBmcy9uZnMvbmZzNHN0YXRlLmMgfCAg ICA2ICsrKystLQ0KPiAgMSBmaWxlcyBjaGFuZ2VkLCA0IGluc2VydGlvbnMoKyksIDIgZGVsZXRp b25zKC0pDQo+IA0KPiBkaWZmIC0tZ2l0IGEvZnMvbmZzL25mczRzdGF0ZS5jIGIvZnMvbmZzL25m czRzdGF0ZS5jDQo+IGluZGV4IGE1MzMxZWMuLjEzNDMyM2EgMTAwNjQ0DQo+IC0tLSBhL2ZzL25m cy9uZnM0c3RhdGUuYw0KPiArKysgYi9mcy9uZnMvbmZzNHN0YXRlLmMNCj4gQEAgLTE2MDAsOCAr MTYwMCw4IEBAIG91dDoNCj4gIAlyZXR1cm4gbmZzNF9yZWNvdmVyeV9oYW5kbGVfZXJyb3IoY2xw LCBzdGF0dXMpOw0KPiAgfQ0KPiAgDQo+IC0vKiBTZXQgTkZTNENMTlRfTEVBU0VfRVhQSVJFRCBm b3IgYWxsIHY0LjAgZXJyb3JzIGFuZCBmb3IgcmVjb3ZlcmFibGUgZXJyb3JzDQo+IC0gKiBvbiBF WENIQU5HRV9JRCBmb3IgdjQuMQ0KPiArLyogU2V0IE5GUzRDTE5U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NeWtsZWJ1c3RAbmV0YXBwLmNvbQ0K d3d3Lm5ldGFwcC5jb20NCg==

#3 lore raw
Quoted 19 lines · Trond
Quoted 18 lines · On Fri, 2012-09-28 at 17:05 -0400, [email protected] wrote:

From: Andy Adamson <[email protected]>

We should always reclaim state when the lease and therefore the clientid is expired.

---
 fs/nfs/nfs4state.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
fs/nfs/nfs4state.c +0 -0
index a5331ec..134323a 100644
@@ -1600,8 +1600,8 @@ out:
      return nfs4_recovery_handle_error(clp, status);
 }
 
Quoted 17 lines

fs/nfs/nfs4state.c static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status) · line 1651

Quoted 13 lines
fs/nfs/nfs4state.c +4 -2
-/* Set NFS4CLNT_LEASE_EXPIRED for all v4.0 errors and for recoverable errors
- * on EXCHANGE_ID for v4.1
+/* Set NFS4CLNT_LEASE_EXPIRED and reclaim reboot state for all v4.0 errors
+ * and for recoverable errors on EXCHANGE_ID for v4.1
  */
 static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status)
 {
@@ -1647,6 +1647,8 @@ static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status)
              return status;
      }
      set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
+     nfs4_state_clear_reclaim_reboot(clp);
+     nfs4_state_start_reclaim_reboot(clp);

This is probably correct for NFS4ERR_STALE_CLIENTID, but certainly not for NFS4ERR_SEQ_MISORDERED, or NFS4ERR_DELAY...

Oops - will resend with fix...

-->Andy

Quoted 11 lines

fs/nfs/nfs4state.c static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status) · line 1654

Quoted 3 lines
fs/nfs/nfs4state.c +0 -0
      dprintk("%s: handled error %d for server %s\n", __func__, status,
                      clp->cl_hostname);
      return 0;

--
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com