diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-03-19 00:45:14 +0100 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-03-25 17:04:10 +0100 |
commit | c58c844187df61ef7cc103d0abb5dd6198bcfcd6 (patch) | |
tree | 0e435c37318e290346f3bed74bba05350ec4dd2f /fs/nfs/nfs4state.c | |
parent | NFSv4: Fail I/O if the state recovery fails irrevocably (diff) | |
download | linux-c58c844187df61ef7cc103d0abb5dd6198bcfcd6.tar.xz linux-c58c844187df61ef7cc103d0abb5dd6198bcfcd6.zip |
NFS: Don't accept more reads/writes if the open context recovery failed
If the state recovery failed, we want to ensure that the application
doesn't try to use the same file descriptor for more reads or writes.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index fec1c5bb4863..8db102c7add6 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1328,9 +1328,25 @@ void nfs_inode_find_state_and_recover(struct inode *inode, nfs4_schedule_state_manager(clp); } +static void nfs4_state_mark_open_context_bad(struct nfs4_state *state) +{ + struct inode *inode = state->inode; + struct nfs_inode *nfsi = NFS_I(inode); + struct nfs_open_context *ctx; + + spin_lock(&inode->i_lock); + list_for_each_entry(ctx, &nfsi->open_files, list) { + if (ctx->state != state) + continue; + set_bit(NFS_CONTEXT_BAD, &ctx->flags); + } + spin_unlock(&inode->i_lock); +} + static void nfs4_state_mark_recovery_failed(struct nfs4_state *state, int error) { set_bit(NFS_STATE_RECOVERY_FAILED, &state->flags); + nfs4_state_mark_open_context_bad(state); } |