@@ -684,7 +684,7 @@ __nfs4_find_state_byowner(struct inode *inode, struct nfs4_state_owner *owner)
684
684
struct nfs_inode * nfsi = NFS_I (inode );
685
685
struct nfs4_state * state ;
686
686
687
- list_for_each_entry (state , & nfsi -> open_states , inode_states ) {
687
+ list_for_each_entry_rcu (state , & nfsi -> open_states , inode_states ) {
688
688
if (state -> owner != owner )
689
689
continue ;
690
690
if (!nfs4_valid_open_stateid (state ))
@@ -698,7 +698,7 @@ __nfs4_find_state_byowner(struct inode *inode, struct nfs4_state_owner *owner)
698
698
static void
699
699
nfs4_free_open_state (struct nfs4_state * state )
700
700
{
701
- kfree (state );
701
+ kfree_rcu (state , rcu_head );
702
702
}
703
703
704
704
struct nfs4_state *
@@ -707,9 +707,9 @@ nfs4_get_open_state(struct inode *inode, struct nfs4_state_owner *owner)
707
707
struct nfs4_state * state , * new ;
708
708
struct nfs_inode * nfsi = NFS_I (inode );
709
709
710
- spin_lock ( & inode -> i_lock );
710
+ rcu_read_lock ( );
711
711
state = __nfs4_find_state_byowner (inode , owner );
712
- spin_unlock ( & inode -> i_lock );
712
+ rcu_read_unlock ( );
713
713
if (state )
714
714
goto out ;
715
715
new = nfs4_alloc_open_state ();
@@ -720,7 +720,7 @@ nfs4_get_open_state(struct inode *inode, struct nfs4_state_owner *owner)
720
720
state = new ;
721
721
state -> owner = owner ;
722
722
atomic_inc (& owner -> so_count );
723
- list_add (& state -> inode_states , & nfsi -> open_states );
723
+ list_add_rcu (& state -> inode_states , & nfsi -> open_states );
724
724
ihold (inode );
725
725
state -> inode = inode ;
726
726
spin_unlock (& inode -> i_lock );
@@ -746,7 +746,7 @@ void nfs4_put_open_state(struct nfs4_state *state)
746
746
if (!atomic_dec_and_lock (& state -> count , & owner -> so_lock ))
747
747
return ;
748
748
spin_lock (& inode -> i_lock );
749
- list_del (& state -> inode_states );
749
+ list_del_rcu (& state -> inode_states );
750
750
list_del (& state -> open_states );
751
751
spin_unlock (& inode -> i_lock );
752
752
spin_unlock (& owner -> so_lock );
0 commit comments