]> rtime.felk.cvut.cz Git - zynq/linux.git/blobdiff - fs/nfs/nfs4proc.c
Apply preempt_rt patch-4.9-rt1.patch.xz
[zynq/linux.git] / fs / nfs / nfs4proc.c
index 2d1481eb19291938816704b257e4c542da38172f..8f9636cc298f81dd68ee755184ce53ec1803e8d5 100644 (file)
@@ -2564,15 +2564,23 @@ static void nfs41_check_delegation_stateid(struct nfs4_state *state)
 static int nfs41_check_expired_locks(struct nfs4_state *state)
 {
        int status, ret = NFS_OK;
-       struct nfs4_lock_state *lsp;
+       struct nfs4_lock_state *lsp, *prev = NULL;
        struct nfs_server *server = NFS_SERVER(state->inode);
 
        if (!test_bit(LK_STATE_IN_USE, &state->flags))
                goto out;
+
+       spin_lock(&state->state_lock);
        list_for_each_entry(lsp, &state->lock_states, ls_locks) {
                if (test_bit(NFS_LOCK_INITIALIZED, &lsp->ls_flags)) {
                        struct rpc_cred *cred = lsp->ls_state->owner->so_cred;
 
+                       atomic_inc(&lsp->ls_count);
+                       spin_unlock(&state->state_lock);
+
+                       nfs4_put_lock_state(prev);
+                       prev = lsp;
+
                        status = nfs41_test_and_free_expired_stateid(server,
                                        &lsp->ls_stateid,
                                        cred);
@@ -2585,10 +2593,14 @@ static int nfs41_check_expired_locks(struct nfs4_state *state)
                                        set_bit(NFS_LOCK_LOST, &lsp->ls_flags);
                        } else if (status != NFS_OK) {
                                ret = status;
-                               break;
+                               nfs4_put_lock_state(prev);
+                               goto out;
                        }
+                       spin_lock(&state->state_lock);
                }
-       };
+       }
+       spin_unlock(&state->state_lock);
+       nfs4_put_lock_state(prev);
 out:
        return ret;
 }
@@ -2685,7 +2697,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
        unsigned int seq;
        int ret;
 
-       seq = raw_seqcount_begin(&sp->so_reclaim_seqcount);
+       seq = raw_seqcount_begin(&sp->so_reclaim_seqlock.seqcount);
 
        ret = _nfs4_proc_open(opendata);
        if (ret != 0)
@@ -2723,7 +2735,7 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata,
        ctx->state = state;
        if (d_inode(dentry) == state->inode) {
                nfs_inode_attach_open_context(ctx);
-               if (read_seqcount_retry(&sp->so_reclaim_seqcount, seq))
+               if (read_seqretry(&sp->so_reclaim_seqlock, seq))
                        nfs4_schedule_stateid_recovery(server, state);
        }
 out:
@@ -9308,20 +9320,14 @@ static const struct inode_operations nfs4_dir_inode_operations = {
        .permission     = nfs_permission,
        .getattr        = nfs_getattr,
        .setattr        = nfs_setattr,
-       .getxattr       = generic_getxattr,
-       .setxattr       = generic_setxattr,
        .listxattr      = nfs4_listxattr,
-       .removexattr    = generic_removexattr,
 };
 
 static const struct inode_operations nfs4_file_inode_operations = {
        .permission     = nfs_permission,
        .getattr        = nfs_getattr,
        .setattr        = nfs_setattr,
-       .getxattr       = generic_getxattr,
-       .setxattr       = generic_setxattr,
        .listxattr      = nfs4_listxattr,
-       .removexattr    = generic_removexattr,
 };
 
 const struct nfs_rpc_ops nfs_v4_clientops = {