X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fnfs%2Fnfs4state.c;h=67b0f489849032cd26874f47ba9662213def6cab;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=91e9bd77e0e990a60bbe0661bf115916757e63a5;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 91e9bd77e..67b0f4898 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -51,7 +51,7 @@ #define OPENOWNER_POOL_SIZE 8 -static spinlock_t state_spinlock = SPIN_LOCK_UNLOCKED; +static DEFINE_SPINLOCK(state_spinlock); nfs4_stateid zero_stateid; @@ -445,7 +445,7 @@ nfs4_get_open_state(struct inode *inode, struct nfs4_state_owner *owner) state->owner = owner; atomic_inc(&owner->so_count); list_add(&state->inode_states, &nfsi->open_states); - state->inode = inode; + state->inode = igrab(inode); spin_unlock(&inode->i_lock); } else { spin_unlock(&inode->i_lock); @@ -471,6 +471,7 @@ void nfs4_put_open_state(struct nfs4_state *state) list_del(&state->inode_states); spin_unlock(&inode->i_lock); list_del(&state->open_states); + iput(inode); BUG_ON (state->state != 0); nfs4_free_open_state(state); nfs4_put_state_owner(owner); @@ -486,7 +487,6 @@ void nfs4_close_state(struct nfs4_state *state, mode_t mode) struct nfs4_state_owner *owner = state->owner; struct nfs4_client *clp = owner->so_client; int newstate; - int status = 0; atomic_inc(&owner->so_count); down_read(&clp->cl_sem); @@ -508,10 +508,8 @@ void nfs4_close_state(struct nfs4_state *state, mode_t mode) newstate |= FMODE_WRITE; if (state->state == newstate) goto out; - if (newstate != 0) - status = nfs4_do_downgrade(inode, state, newstate); - else - status = nfs4_do_close(inode, state); + if (nfs4_do_close(inode, state, newstate) == -EINPROGRESS) + return; } out: nfs4_put_open_state(state);