ALSA: hda: Use LPIB for Toshiba A100-259
[safe/jmp/linux-2.6] / fs / nfs / callback_proc.c
index 4062f76..a08770a 100644 (file)
@@ -7,6 +7,7 @@
  */
 #include <linux/nfs4.h>
 #include <linux/nfs_fs.h>
+#include <linux/slab.h>
 #include "nfs4_fs.h"
 #include "callback.h"
 #include "delegation.h"
@@ -151,7 +152,7 @@ int nfs41_validate_delegation_stateid(struct nfs_delegation *delegation, const n
  * checking the used_slots bit array on the table.  The lower layer guarantees
  * a single outstanding callback request at a time.
  */
-static int
+static __be32
 validate_seqid(struct nfs4_slot_table *tbl, struct cb_sequenceargs * args)
 {
        struct nfs4_slot *slot;
@@ -285,11 +286,12 @@ out:
        return status;
 }
 
-unsigned nfs4_callback_sequence(struct cb_sequenceargs *args,
+__be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
                                struct cb_sequenceres *res)
 {
        struct nfs_client *clp;
-       int i, status;
+       int i;
+       __be32 status;
 
        status = htonl(NFS4ERR_BADSESSION);
        clp = find_client_with_session(args->csa_addr, 4, &args->csa_sessionid);
@@ -333,10 +335,10 @@ out:
        return status;
 }
 
-unsigned nfs4_callback_recallany(struct cb_recallanyargs *args, void *dummy)
+__be32 nfs4_callback_recallany(struct cb_recallanyargs *args, void *dummy)
 {
        struct nfs_client *clp;
-       int status;
+       __be32 status;
        fmode_t flags = 0;
 
        status = htonl(NFS4ERR_OP_NOT_IN_SESSION);
@@ -361,4 +363,40 @@ out:
        dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
        return status;
 }
+
+/* Reduce the fore channel's max_slots to the target value */
+__be32 nfs4_callback_recallslot(struct cb_recallslotargs *args, void *dummy)
+{
+       struct nfs_client *clp;
+       struct nfs4_slot_table *fc_tbl;
+       __be32 status;
+
+       status = htonl(NFS4ERR_OP_NOT_IN_SESSION);
+       clp = nfs_find_client(args->crsa_addr, 4);
+       if (clp == NULL)
+               goto out;
+
+       dprintk("NFS: CB_RECALL_SLOT request from %s target max slots %d\n",
+               rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR),
+               args->crsa_target_max_slots);
+
+       fc_tbl = &clp->cl_session->fc_slot_table;
+
+       status = htonl(NFS4ERR_BAD_HIGH_SLOT);
+       if (args->crsa_target_max_slots > fc_tbl->max_slots ||
+           args->crsa_target_max_slots < 1)
+               goto out_putclient;
+
+       status = htonl(NFS4_OK);
+       if (args->crsa_target_max_slots == fc_tbl->max_slots)
+               goto out_putclient;
+
+       fc_tbl->target_max_slots = args->crsa_target_max_slots;
+       nfs41_handle_recall_slot(clp);
+out_putclient:
+       nfs_put_client(clp);    /* balance nfs_find_client */
+out:
+       dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
+       return status;
+}
 #endif /* CONFIG_NFS_V4_1 */