NFS: Move NFS v3 acl functions to nfs3_fs.h
[linux-2.6-block.git] / fs / nfs / nfs4proc.c
index 7dd8aca31c29b9c0079dce94136e70d716072f78..0b711227cfa51ffa7922711ba145d5bd53f47669 100644 (file)
@@ -1307,15 +1307,13 @@ static struct nfs4_state *nfs4_try_open_cached(struct nfs4_opendata *opendata)
        int ret = -EAGAIN;
 
        for (;;) {
+               spin_lock(&state->owner->so_lock);
                if (can_open_cached(state, fmode, open_mode)) {
-                       spin_lock(&state->owner->so_lock);
-                       if (can_open_cached(state, fmode, open_mode)) {
-                               update_open_stateflags(state, fmode);
-                               spin_unlock(&state->owner->so_lock);
-                               goto out_return_state;
-                       }
+                       update_open_stateflags(state, fmode);
                        spin_unlock(&state->owner->so_lock);
+                       goto out_return_state;
                }
+               spin_unlock(&state->owner->so_lock);
                rcu_read_lock();
                delegation = rcu_dereference(nfsi->delegation);
                if (!can_open_delegated(delegation, fmode)) {
@@ -7579,11 +7577,16 @@ static void nfs4_layoutget_done(struct rpc_task *task, void *calldata)
                } else {
                        LIST_HEAD(head);
 
+                       /*
+                        * Mark the bad layout state as invalid, then retry
+                        * with the current stateid.
+                        */
                        pnfs_mark_matching_lsegs_invalid(lo, &head, NULL);
                        spin_unlock(&inode->i_lock);
-                       /* Mark the bad layout state as invalid, then
-                        * retry using the open stateid. */
                        pnfs_free_lseg_list(&head);
+       
+                       task->tk_status = 0;
+                       rpc_restart_call_prepare(task);
                }
        }
        if (nfs4_async_handle_error(task, server, state) == -EAGAIN)
@@ -7805,54 +7808,6 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp)
        return status;
 }
 
-/*
- * Retrieve the list of Data Server devices from the MDS.
- */
-static int _nfs4_getdevicelist(struct nfs_server *server,
-                                   const struct nfs_fh *fh,
-                                   struct pnfs_devicelist *devlist)
-{
-       struct nfs4_getdevicelist_args args = {
-               .fh = fh,
-               .layoutclass = server->pnfs_curr_ld->id,
-       };
-       struct nfs4_getdevicelist_res res = {
-               .devlist = devlist,
-       };
-       struct rpc_message msg = {
-               .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETDEVICELIST],
-               .rpc_argp = &args,
-               .rpc_resp = &res,
-       };
-       int status;
-
-       dprintk("--> %s\n", __func__);
-       status = nfs4_call_sync(server->client, server, &msg, &args.seq_args,
-                               &res.seq_res, 0);
-       dprintk("<-- %s status=%d\n", __func__, status);
-       return status;
-}
-
-int nfs4_proc_getdevicelist(struct nfs_server *server,
-                           const struct nfs_fh *fh,
-                           struct pnfs_devicelist *devlist)
-{
-       struct nfs4_exception exception = { };
-       int err;
-
-       do {
-               err = nfs4_handle_exception(server,
-                               _nfs4_getdevicelist(server, fh, devlist),
-                               &exception);
-       } while (exception.retry);
-
-       dprintk("%s: err=%d, num_devs=%u\n", __func__,
-               err, devlist->num_devs);
-
-       return err;
-}
-EXPORT_SYMBOL_GPL(nfs4_proc_getdevicelist);
-
 static int
 _nfs4_proc_getdeviceinfo(struct nfs_server *server,
                struct pnfs_device *pdev,