Skip to contentSkip to conversation

Fixing lease renewal

PATCH In review Olga Kornievskaia 3 participants 6 messages Sep 24, 2014

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

PATCH 1/1 Fixing lease renewal

Commit c9fdeb28 removed a 'continue' after checking if the lease needs to be renewed. However, if client hasn't moved, the code falls down to starting reboot recovery erroneously (ie., sends open reclaim and gets back stale_clientid error) before recovering from getting stale_clientid on the renew operation.

---
 fs/nfs/nfs4state.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/nfs4state.c +3 -1
index 22fe351..4616598 100644
@@ -2340,11 +2340,13 @@ static void nfs4_state_manager(struct nfs_client *clp)
 			continue;
 		}
 
-		if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
+		if (!test_bit(NFS4CLNT_MOVED, &clp->cl_state) &&
+		     test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
 			section = "check lease";
 			status = nfs4_check_lease(clp);
 			if (status < 0)
 				goto out_error;
+			continue;
 		}
 
 		if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
Signature · 1 line
1.8.5.2 (Apple Git-48)
#1 lore raw

Hi Olga,

Quoted 31 lines · Olga Kornievskaia

Commit c9fdeb28 removed a 'continue' after checking if the lease needs to be renewed. However, if client hasn't moved, the code falls down to starting reboot recovery erroneously (ie., sends open reclaim and gets back stale_clientid error) before recovering from getting stale_clientid on the renew operation.

---
 fs/nfs/nfs4state.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/nfs4state.c +3 -2
index 22fe351..4616598 100644
@@ -2340,11 +2340,13 @@ static void nfs4_state_manager(struct nfs_client *clp)
                        continue;
                }
 
-               if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
+               if (!test_bit(NFS4CLNT_MOVED, &clp->cl_state) &&
+                    test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
                        section = "check lease";
                        status = nfs4_check_lease(clp);
                        if (status < 0)
                                goto out_error;
+                       continue;
                }
 
                if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
--
Quoted 2 lines

1.8.5.2 (Apple Git-48)

I think you misunderstood me. I was proposing that we move the entire code section that currently reads

                if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
                        section = "migration";
                        status = nfs4_handle_migration(clp);
                        if (status < 0)
                                goto out_error;
                }

so that it occurs before the section

                if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
                        section = "check lease";
                        status = nfs4_check_lease(clp);
                        if (status < 0)
                                goto out_error;
+                      continue;
                }

That way we only need to test once for NFS4CLNT_MOVED.

Cheers
Trond

Signature · 5 lines
Trond Myklebust

Linux NFS client maintainer, PrimaryData

[email protected]
#2 lore raw

I have misunderstood you. One more try coming up.

Quoted 71 lines · Trond Myklebust

Hi Olga,

Quoted 31 lines · Olga Kornievskaia

Commit c9fdeb28 removed a 'continue' after checking if the lease needs to be renewed. However, if client hasn't moved, the code falls down to starting reboot recovery erroneously (ie., sends open reclaim and gets back stale_clientid error) before recovering from getting stale_clientid on the renew operation.

---
 fs/nfs/nfs4state.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/nfs4state.c +3 -2
index 22fe351..4616598 100644
@@ -2340,11 +2340,13 @@ static void nfs4_state_manager(struct nfs_client *clp)
                        continue;
                }
 
-               if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
+               if (!test_bit(NFS4CLNT_MOVED, &clp->cl_state) &&
+                    test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
                        section = "check lease";
                        status = nfs4_check_lease(clp);
                        if (status < 0)
                                goto out_error;
+                       continue;
                }
 
                if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
--
Quoted 2 lines

1.8.5.2 (Apple Git-48)

I think you misunderstood me. I was proposing that we move the entire code section that currently reads

                if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
                        section = "migration";
                        status = nfs4_handle_migration(clp);
                        if (status < 0)
                                goto out_error;
                }

so that it occurs before the section

                if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
                        section = "check lease";
                        status = nfs4_check_lease(clp);
                        if (status < 0)
                                goto out_error;
+                      continue;
                }

That way we only need to test once for NFS4CLNT_MOVED.

Cheers
Trond
--
Trond Myklebust

Linux NFS client maintainer, PrimaryData

[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to Trond Myklebust

Before I go ahead with the change, does it make sense to move "both" of the migration sections NFS4CLNT_MOVED and NFS4CLNT_LEASE_MOVED before the check lease section?

Quoted 71 lines · Trond Myklebust

Hi Olga,

Quoted 31 lines · Olga Kornievskaia

Commit c9fdeb28 removed a 'continue' after checking if the lease needs to be renewed. However, if client hasn't moved, the code falls down to starting reboot recovery erroneously (ie., sends open reclaim and gets back stale_clientid error) before recovering from getting stale_clientid on the renew operation.

---
 fs/nfs/nfs4state.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/nfs4state.c +3 -2
index 22fe351..4616598 100644
@@ -2340,11 +2340,13 @@ static void nfs4_state_manager(struct nfs_client *clp)
                        continue;
                }
 
-               if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
+               if (!test_bit(NFS4CLNT_MOVED, &clp->cl_state) &&
+                    test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
                        section = "check lease";
                        status = nfs4_check_lease(clp);
                        if (status < 0)
                                goto out_error;
+                       continue;
                }
 
                if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
--
Quoted 2 lines

1.8.5.2 (Apple Git-48)

I think you misunderstood me. I was proposing that we move the entire code section that currently reads

                if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
                        section = "migration";
                        status = nfs4_handle_migration(clp);
                        if (status < 0)
                                goto out_error;
                }

so that it occurs before the section

                if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
                        section = "check lease";
                        status = nfs4_check_lease(clp);
                        if (status < 0)
                                goto out_error;
+                      continue;
                }

That way we only need to test once for NFS4CLNT_MOVED.

Cheers
Trond
--
Trond Myklebust

Linux NFS client maintainer, PrimaryData

[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 3 lines · Olga Kornievskaia

Before I go ahead with the change, does it make sense to move "both" of the migration sections NFS4CLNT_MOVED and NFS4CLNT_LEASE_MOVED before the check lease section?

Actually. Never mind. Thinking about this, and looking at the code, we definitely do want to ensure that lease recovery is performed before migration recovery.
Let's just put the 'continue;' back into the CHECK_LEASE section for now so that we enforce that.

Quoted 73 lines
Quoted 71 lines · Trond Myklebust

Hi Olga,

Quoted 31 lines · Olga Kornievskaia

Commit c9fdeb28 removed a 'continue' after checking if the lease needs to be renewed. However, if client hasn't moved, the code falls down to starting reboot recovery erroneously (ie., sends open reclaim and gets back stale_clientid error) before recovering from getting stale_clientid on the renew operation.

---
 fs/nfs/nfs4state.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/nfs4state.c +3 -2
index 22fe351..4616598 100644
@@ -2340,11 +2340,13 @@ static void nfs4_state_manager(struct nfs_client *clp)
                        continue;
                }
 
-               if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
+               if (!test_bit(NFS4CLNT_MOVED, &clp->cl_state) &&
+                    test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
                        section = "check lease";
                        status = nfs4_check_lease(clp);
                        if (status < 0)
                                goto out_error;
+                       continue;
                }
 
                if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
--
Quoted 2 lines

1.8.5.2 (Apple Git-48)

I think you misunderstood me. I was proposing that we move the entire code section that currently reads

                if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
                        section = "migration";
                        status = nfs4_handle_migration(clp);
                        if (status < 0)
                                goto out_error;
                }

so that it occurs before the section

                if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
                        section = "check lease";
                        status = nfs4_check_lease(clp);
                        if (status < 0)
                                goto out_error;
+                      continue;
                }

That way we only need to test once for NFS4CLNT_MOVED.

Cheers
Trond
--
Trond Myklebust

Linux NFS client maintainer, PrimaryData

[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Trond Myklebust

Linux NFS client maintainer, PrimaryData

[email protected]
#5 lore raw
Quoted 11 lines · Trond Myklebust
Quoted 3 lines · Olga Kornievskaia

Before I go ahead with the change, does it make sense to move "both" of the migration sections NFS4CLNT_MOVED and NFS4CLNT_LEASE_MOVED before the check lease section?

Actually. Never mind. Thinking about this, and looking at the code, we definitely do want to ensure that lease recovery is performed before migration recovery.
Let's just put the 'continue;' back into the CHECK_LEASE section for now so that we enforce that.

Ok. Another one submitted.

Quoted 82 lines
Quoted 66 lines
Quoted 64 lines · Trond Myklebust

Hi Olga,

Quoted 31 lines · Olga Kornievskaia

Commit c9fdeb28 removed a 'continue' after checking if the lease needs to be renewed. However, if client hasn't moved, the code falls down to starting reboot recovery erroneously (ie., sends open reclaim and gets back stale_clientid error) before recovering from getting stale_clientid on the renew operation.

---
 fs/nfs/nfs4state.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs/nfs4state.c +3 -2
index 22fe351..4616598 100644
@@ -2340,11 +2340,13 @@ static void nfs4_state_manager(struct nfs_client *clp)
                        continue;
                }
 
-               if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
+               if (!test_bit(NFS4CLNT_MOVED, &clp->cl_state) &&
+                    test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
                        section = "check lease";
                        status = nfs4_check_lease(clp);
                        if (status < 0)
                                goto out_error;
+                       continue;
                }
 
                if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
--
Quoted 2 lines

1.8.5.2 (Apple Git-48)

I think you misunderstood me. I was proposing that we move the entire code section that currently reads

                if (test_and_clear_bit(NFS4CLNT_MOVED, &clp->cl_state)) {
                        section = "migration";
                        status = nfs4_handle_migration(clp);
                        if (status < 0)
                                goto out_error;
                }

so that it occurs before the section

                if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {
                        section = "check lease";
                        status = nfs4_check_lease(clp);
                        if (status < 0)
                                goto out_error;
+                      continue;
                }

That way we only need to test once for NFS4CLNT_MOVED.

Cheers
Trond
--
Trond Myklebust

Quoted 7 lines
Quoted 7 lines

Linux NFS client maintainer, PrimaryData

[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Trond Myklebust

Linux NFS client maintainer, PrimaryData

[email protected]