diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-12-03 15:53:21 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2009-12-03 15:53:21 -0500 |
commit | a9ed2e2583747fb3139a764c317fac58893b968f (patch) | |
tree | 55d6504df716da57884cee0593b86f3a04558401 /fs/nfs | |
parent | c8b7ae3d3221536228260757444ee10c6d71793f (diff) |
NFSv4: Handle NFS4ERR_GRACE when recovering an expired lease.
If our lease expires, and the server reboots while we're recovering, we
need to be able to wait until the grace period is over.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 741a562177fc..c7b8d39a3ce1 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1488,7 +1488,7 @@ static int _nfs4_open_expired(struct nfs_open_context *ctx, struct nfs4_state *s | |||
1488 | return ret; | 1488 | return ret; |
1489 | } | 1489 | } |
1490 | 1490 | ||
1491 | static inline int nfs4_do_open_expired(struct nfs_open_context *ctx, struct nfs4_state *state) | 1491 | static int nfs4_do_open_expired(struct nfs_open_context *ctx, struct nfs4_state *state) |
1492 | { | 1492 | { |
1493 | struct nfs_server *server = NFS_SERVER(state->inode); | 1493 | struct nfs_server *server = NFS_SERVER(state->inode); |
1494 | struct nfs4_exception exception = { }; | 1494 | struct nfs4_exception exception = { }; |
@@ -1496,10 +1496,16 @@ static inline int nfs4_do_open_expired(struct nfs_open_context *ctx, struct nfs4 | |||
1496 | 1496 | ||
1497 | do { | 1497 | do { |
1498 | err = _nfs4_open_expired(ctx, state); | 1498 | err = _nfs4_open_expired(ctx, state); |
1499 | if (err != -NFS4ERR_DELAY) | 1499 | switch (err) { |
1500 | break; | 1500 | default: |
1501 | nfs4_handle_exception(server, err, &exception); | 1501 | goto out; |
1502 | case -NFS4ERR_GRACE: | ||
1503 | case -NFS4ERR_DELAY: | ||
1504 | nfs4_handle_exception(server, err, &exception); | ||
1505 | err = 0; | ||
1506 | } | ||
1502 | } while (exception.retry); | 1507 | } while (exception.retry); |
1508 | out: | ||
1503 | return err; | 1509 | return err; |
1504 | } | 1510 | } |
1505 | 1511 | ||
@@ -4049,10 +4055,16 @@ static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request | |||
4049 | if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) | 4055 | if (test_bit(NFS_DELEGATED_STATE, &state->flags) != 0) |
4050 | return 0; | 4056 | return 0; |
4051 | err = _nfs4_do_setlk(state, F_SETLK, request, 0); | 4057 | err = _nfs4_do_setlk(state, F_SETLK, request, 0); |
4052 | if (err != -NFS4ERR_DELAY) | 4058 | switch (err) { |
4053 | break; | 4059 | default: |
4054 | nfs4_handle_exception(server, err, &exception); | 4060 | goto out; |
4061 | case -NFS4ERR_GRACE: | ||
4062 | case -NFS4ERR_DELAY: | ||
4063 | nfs4_handle_exception(server, err, &exception); | ||
4064 | err = 0; | ||
4065 | } | ||
4055 | } while (exception.retry); | 4066 | } while (exception.retry); |
4067 | out: | ||
4056 | return err; | 4068 | return err; |
4057 | } | 4069 | } |
4058 | 4070 | ||