Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294446
b: refs/heads/master
c: b01dd1d
h: refs/heads/master
v: v3
  • Loading branch information
Bryan Schumaker authored and Trond Myklebust committed Feb 6, 2012
1 parent 65f4e19 commit 106291b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1cab0652ba985d11b67645bd344c39ebb6cd28a2
refs/heads/master: b01dd1d8fae6178cbec374b90da2e4a3b8dce9ba
58 changes: 47 additions & 11 deletions trunk/fs/nfs/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1723,15 +1723,32 @@ static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *sta
}

#if defined(CONFIG_NFS_V4_1)
static int nfs41_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state)
static int nfs41_check_expired_stateid(struct nfs4_state *state, nfs4_stateid *stateid, unsigned int flags)
{
int status;
int status = NFS_OK;
struct nfs_server *server = NFS_SERVER(state->inode);

status = nfs41_test_stateid(server, &state->stateid);
if (status == NFS_OK)
return 0;
nfs41_free_stateid(server, &state->stateid);
if (state->flags & flags) {
status = nfs41_test_stateid(server, stateid);
if (status != NFS_OK) {
nfs41_free_stateid(server, stateid);
state->flags &= ~flags;
}
}
return status;
}

static int nfs41_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state)
{
int deleg_status, open_status;
int deleg_flags = 1 << NFS_DELEGATED_STATE;
int open_flags = (1 << NFS_O_RDONLY_STATE) | (1 << NFS_O_WRONLY_STATE) | (1 << NFS_O_RDWR_STATE);

deleg_status = nfs41_check_expired_stateid(state, &state->stateid, deleg_flags);
open_status = nfs41_check_expired_stateid(state, &state->open_stateid, open_flags);

if ((deleg_status == NFS_OK) && (open_status == NFS_OK))
return NFS_OK;
return nfs4_open_expired(sp, state);
}
#endif
Expand Down Expand Up @@ -4504,15 +4521,34 @@ static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request
}

#if defined(CONFIG_NFS_V4_1)
static int nfs41_lock_expired(struct nfs4_state *state, struct file_lock *request)
static int nfs41_check_expired_locks(struct nfs4_state *state)
{
int status;
int status, ret = NFS_OK;
struct nfs4_lock_state *lsp;
struct nfs_server *server = NFS_SERVER(state->inode);

status = nfs41_test_stateid(server, &state->stateid);
list_for_each_entry(lsp, &state->lock_states, ls_locks) {
if (lsp->ls_flags & NFS_LOCK_INITIALIZED) {
status = nfs41_test_stateid(server, &lsp->ls_stateid);
if (status != NFS_OK) {
nfs41_free_stateid(server, &lsp->ls_stateid);
lsp->ls_flags &= ~NFS_LOCK_INITIALIZED;
ret = status;
}
}
};

return ret;
}

static int nfs41_lock_expired(struct nfs4_state *state, struct file_lock *request)
{
int status = NFS_OK;

if (test_bit(LK_STATE_IN_USE, &state->flags))
status = nfs41_check_expired_locks(state);
if (status == NFS_OK)
return 0;
nfs41_free_stateid(server, &state->stateid);
return status;
return nfs4_lock_expired(state, request);
}
#endif
Expand Down

0 comments on commit 106291b

Please sign in to comment.