]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'devel' into next
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 30 Dec 2008 21:51:43 +0000 (16:51 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 30 Dec 2008 21:51:43 +0000 (16:51 -0500)
1  2 
fs/lockd/host.c
fs/nfs/nfsroot.c
fs/nfs/super.c
fs/nfsd/nfs4state.c
net/sunrpc/auth.c
net/sunrpc/clnt.c

diff --combined fs/lockd/host.c
index e05d044160378fefd2989674903c032d5668183a,acc2aa5021d1a8e8c6dee3b0392059b75d08e015..abdebf76b8203c12a6a12532e12f498b83a90614
@@@ -48,6 -48,7 +48,7 @@@ struct nlm_lookup_host_info 
        const size_t            hostname_len;   /* it's length */
        const struct sockaddr   *src_sap;       /* our address (optional) */
        const size_t            src_len;        /* it's length */
+       const int               noresvport;     /* use non-priv port */
  };
  
  /*
@@@ -115,14 -116,14 +116,14 @@@ static void nlm_display_address(const s
                snprintf(buf, len, "unspecified");
                break;
        case AF_INET:
 -              snprintf(buf, len, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr));
 +              snprintf(buf, len, "%pI4", &sin->sin_addr.s_addr);
                break;
        case AF_INET6:
                if (ipv6_addr_v4mapped(&sin6->sin6_addr))
 -                      snprintf(buf, len, NIPQUAD_FMT,
 -                               NIPQUAD(sin6->sin6_addr.s6_addr32[3]));
 +                      snprintf(buf, len, "%pI4",
 +                               &sin6->sin6_addr.s6_addr32[3]);
                else
 -                      snprintf(buf, len, NIP6_FMT, NIP6(sin6->sin6_addr));
 +                      snprintf(buf, len, "%pI6", &sin6->sin6_addr);
                break;
        default:
                snprintf(buf, len, "unsupported address family");
@@@ -222,6 -223,7 +223,7 @@@ static struct nlm_host *nlm_lookup_host
        host->h_nsmstate   = 0;                 /* real NSM state */
        host->h_nsmhandle  = nsm;
        host->h_server     = ni->server;
+       host->h_noresvport = ni->noresvport;
        hlist_add_head(&host->h_hash, chain);
        INIT_LIST_HEAD(&host->h_lockowners);
        spin_lock_init(&host->h_lock);
@@@ -272,6 -274,7 +274,7 @@@ nlm_destroy_host(struct nlm_host *host
   * @protocol: transport protocol to use
   * @version: NLM protocol version
   * @hostname: '\0'-terminated hostname of server
+  * @noresvport: 1 if non-privileged port should be used
   *
   * Returns an nlm_host structure that matches the passed-in
   * [server address, transport protocol, NLM version, server hostname].
  struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap,
                                     const size_t salen,
                                     const unsigned short protocol,
-                                    const u32 version, const char *hostname)
+                                    const u32 version,
+                                    const char *hostname,
+                                    int noresvport)
  {
        const struct sockaddr source = {
                .sa_family      = AF_UNSPEC,
                .hostname_len   = strlen(hostname),
                .src_sap        = &source,
                .src_len        = sizeof(source),
+               .noresvport     = noresvport,
        };
  
        dprintk("lockd: %s(host='%s', vers=%u, proto=%s)\n", __func__,
@@@ -417,6 -423,8 +423,8 @@@ nlm_bind_host(struct nlm_host *host
                 */
                if (!host->h_server)
                        args.flags |= RPC_CLNT_CREATE_HARDRTRY;
+               if (host->h_noresvport)
+                       args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
  
                clnt = rpc_create(&args);
                if (!IS_ERR(clnt))
diff --combined fs/nfs/nfsroot.c
index d74d16ce0d49920ed710d0602c4797213aa79d38,f015e0d62add2b90dd215071890b6ba332a29ef1..d9ef602fbc5a893f60d087fe00a2744b7fdcd9e4
@@@ -86,6 -86,8 +86,8 @@@
  #include <net/ipconfig.h>
  #include <linux/parser.h>
  
+ #include "internal.h"
  /* Define this to allow debugging output */
  #undef NFSROOT_DEBUG
  #define NFSDBG_FACILITY NFSDBG_ROOT
@@@ -100,7 -102,7 +102,7 @@@ static char nfs_root_name[256] __initda
  static __be32 servaddr __initdata = 0;
  
  /* Name of directory to mount */
- static char nfs_path[NFS_MAXPATHLEN] __initdata = { 0, };
+ static char nfs_export_path[NFS_MAXPATHLEN] __initdata = { 0, };
  
  /* NFS-related data */
  static struct nfs_mount_data nfs_data __initdata = { 0, };/* NFS mount info */
@@@ -312,7 -314,7 +314,7 @@@ static int __init root_nfs_name(char *n
                printk(KERN_ERR "Root-NFS: Pathname for remote directory too long.\n");
                return -1;
        }
-       sprintf(nfs_path, buf, cp);
+       sprintf(nfs_export_path, buf, cp);
  
        return 1;
  }
@@@ -329,7 -331,7 +331,7 @@@ static int __init root_nfs_addr(void
        }
  
        snprintf(nfs_data.hostname, sizeof(nfs_data.hostname),
 -               "%u.%u.%u.%u", NIPQUAD(servaddr));
 +               "%pI4", &servaddr);
        return 0;
  }
  
  static void __init root_nfs_print(void)
  {
        printk(KERN_NOTICE "Root-NFS: Mounting %s on server %s as root\n",
-               nfs_path, nfs_data.hostname);
+               nfs_export_path, nfs_data.hostname);
        printk(KERN_NOTICE "Root-NFS:     rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
                nfs_data.rsize, nfs_data.wsize, nfs_data.timeo, nfs_data.retrans);
        printk(KERN_NOTICE "Root-NFS:     acreg (min,max) = (%d,%d), acdir (min,max) = (%d,%d)\n",
@@@ -421,8 -423,8 +423,8 @@@ static int __init root_nfs_getport(int 
  {
        struct sockaddr_in sin;
  
 -      printk(KERN_NOTICE "Looking up port of RPC %d/%d on %u.%u.%u.%u\n",
 -              program, version, NIPQUAD(servaddr));
 +      printk(KERN_NOTICE "Looking up port of RPC %d/%d on %pI4\n",
 +              program, version, &servaddr);
        set_sockaddr(&sin, servaddr, 0);
        return rpcb_getport_sync(&sin, program, version, proto);
  }
@@@ -485,18 -487,23 +487,23 @@@ static int __init root_nfs_get_handle(v
  {
        struct nfs_fh fh;
        struct sockaddr_in sin;
+       struct nfs_mount_request request = {
+               .sap            = (struct sockaddr *)&sin,
+               .salen          = sizeof(sin),
+               .dirpath        = nfs_export_path,
+               .version        = (nfs_data.flags & NFS_MOUNT_VER3) ?
+                                       NFS_MNT3_VERSION : NFS_MNT_VERSION,
+               .protocol       = (nfs_data.flags & NFS_MOUNT_TCP) ?
+                                       XPRT_TRANSPORT_TCP : XPRT_TRANSPORT_UDP,
+               .fh             = &fh,
+       };
        int status;
-       int protocol = (nfs_data.flags & NFS_MOUNT_TCP) ?
-                                       XPRT_TRANSPORT_TCP : XPRT_TRANSPORT_UDP;
-       int version = (nfs_data.flags & NFS_MOUNT_VER3) ?
-                                       NFS_MNT3_VERSION : NFS_MNT_VERSION;
  
        set_sockaddr(&sin, servaddr, htons(mount_port));
-       status = nfs_mount((struct sockaddr *) &sin, sizeof(sin), NULL,
-                          nfs_path, version, protocol, &fh);
+       status = nfs_mount(&request);
        if (status < 0)
                printk(KERN_ERR "Root-NFS: Server returned error %d "
-                               "while mounting %s\n", status, nfs_path);
+                               "while mounting %s\n", status, nfs_export_path);
        else {
                nfs_data.root.size = fh.size;
                memcpy(nfs_data.root.data, fh.data, fh.size);
diff --combined fs/nfs/super.c
index bb0313ac9e1fa1a6b94ddb51229298e88b955bfd,bd4c3dd550df99f7ba8eb5d704ca481f4962ae87..d6686f4786dc55b5d5f06afe913e2930f2b45b96
@@@ -75,6 -75,7 +75,7 @@@ enum 
        Opt_acl, Opt_noacl,
        Opt_rdirplus, Opt_nordirplus,
        Opt_sharecache, Opt_nosharecache,
+       Opt_resvport, Opt_noresvport,
  
        /* Mount options that take integer arguments */
        Opt_port,
@@@ -129,6 -130,8 +130,8 @@@ static const match_table_t nfs_mount_op
        { Opt_nordirplus, "nordirplus" },
        { Opt_sharecache, "sharecache" },
        { Opt_nosharecache, "nosharecache" },
+       { Opt_resvport, "resvport" },
+       { Opt_noresvport, "noresvport" },
  
        { Opt_port, "port=%u" },
        { Opt_rsize, "rsize=%u" },
@@@ -462,12 -465,14 +465,12 @@@ static void nfs_show_mountd_options(str
        switch (sap->sa_family) {
        case AF_INET: {
                struct sockaddr_in *sin = (struct sockaddr_in *)sap;
 -              seq_printf(m, ",mountaddr=" NIPQUAD_FMT,
 -                              NIPQUAD(sin->sin_addr.s_addr));
 +              seq_printf(m, ",mountaddr=%pI4", &sin->sin_addr.s_addr);
                break;
        }
        case AF_INET6: {
                struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
 -              seq_printf(m, ",mountaddr=" NIP6_FMT,
 -                              NIP6(sin6->sin6_addr));
 +              seq_printf(m, ",mountaddr=%pI6", &sin6->sin6_addr);
                break;
        }
        default:
@@@ -512,7 -517,8 +515,8 @@@ static void nfs_show_mount_options(stru
                { NFS_MOUNT_NONLM, ",nolock", "" },
                { NFS_MOUNT_NOACL, ",noacl", "" },
                { NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" },
-               { NFS_MOUNT_UNSHARED, ",nosharecache", ""},
+               { NFS_MOUNT_UNSHARED, ",nosharecache", "" },
+               { NFS_MOUNT_NORESVPORT, ",noresvport", "" },
                { 0, NULL, NULL }
        };
        const struct proc_nfs_info *nfs_infop;
@@@ -1033,6 -1039,12 +1037,12 @@@ static int nfs_parse_mount_options(cha
                case Opt_nosharecache:
                        mnt->flags |= NFS_MOUNT_UNSHARED;
                        break;
+               case Opt_resvport:
+                       mnt->flags &= ~NFS_MOUNT_NORESVPORT;
+                       break;
+               case Opt_noresvport:
+                       mnt->flags |= NFS_MOUNT_NORESVPORT;
+                       break;
  
                /*
                 * options that take numeric values
@@@ -1327,8 -1339,14 +1337,14 @@@ out_security_failure
  static int nfs_try_mount(struct nfs_parsed_mount_data *args,
                         struct nfs_fh *root_fh)
  {
-       struct sockaddr *sap = (struct sockaddr *)&args->mount_server.address;
-       char *hostname;
+       struct nfs_mount_request request = {
+               .sap            = (struct sockaddr *)
+                                               &args->mount_server.address,
+               .dirpath        = args->nfs_server.export_path,
+               .protocol       = args->mount_server.protocol,
+               .fh             = root_fh,
+               .noresvport     = args->flags & NFS_MOUNT_NORESVPORT,
+       };
        int status;
  
        if (args->mount_server.version == 0) {
                else
                        args->mount_server.version = NFS_MNT_VERSION;
        }
+       request.version = args->mount_server.version;
  
        if (args->mount_server.hostname)
-               hostname = args->mount_server.hostname;
+               request.hostname = args->mount_server.hostname;
        else
-               hostname = args->nfs_server.hostname;
+               request.hostname = args->nfs_server.hostname;
  
        /*
         * Construct the mount server's address.
         */
        if (args->mount_server.address.ss_family == AF_UNSPEC) {
-               memcpy(sap, &args->nfs_server.address,
+               memcpy(request.sap, &args->nfs_server.address,
                       args->nfs_server.addrlen);
                args->mount_server.addrlen = args->nfs_server.addrlen;
        }
+       request.salen = args->mount_server.addrlen;
  
        /*
         * autobind will be used if mount_server.port == 0
         */
-       nfs_set_port(sap, args->mount_server.port);
+       nfs_set_port(request.sap, args->mount_server.port);
  
        /*
         * Now ask the mount server to map our export path
         * to a file handle.
         */
-       status = nfs_mount(sap,
-                          args->mount_server.addrlen,
-                          hostname,
-                          args->nfs_server.export_path,
-                          args->mount_server.version,
-                          args->mount_server.protocol,
-                          root_fh);
+       status = nfs_mount(&request);
        if (status == 0)
                return 0;
  
        dfprintk(MOUNT, "NFS: unable to mount server %s, error %d\n",
-                       hostname, status);
+                       request.hostname, status);
        return status;
  }
  
@@@ -2419,7 -2433,7 +2431,7 @@@ static void nfs4_kill_super(struct supe
  {
        struct nfs_server *server = NFS_SB(sb);
  
-       nfs_return_all_delegations(sb);
+       nfs_super_return_all_delegations(sb);
        kill_anon_super(sb);
  
        nfs4_renewd_prepare_shutdown(server);
diff --combined fs/nfsd/nfs4state.c
index bf4cd46a5a11489cfd4d726317362b1cc1c5a381,07db31568ac90ab7e1340629efea0f12299cfed5..13e0e074dbb8154aa4cc49a45405478efe929cb7
@@@ -54,6 -54,7 +54,7 @@@
  #include <linux/mutex.h>
  #include <linux/lockd/bind.h>
  #include <linux/module.h>
+ #include <linux/sunrpc/svcauth_gss.h>
  
  #define NFSDDBG_FACILITY                NFSDDBG_PROC
  
@@@ -377,6 -378,7 +378,7 @@@ free_client(struct nfs4_client *clp
        shutdown_callback_client(clp);
        if (clp->cl_cred.cr_group_info)
                put_group_info(clp->cl_cred.cr_group_info);
+       kfree(clp->cl_principal);
        kfree(clp->cl_name.data);
        kfree(clp);
  }
@@@ -696,6 -698,7 +698,7 @@@ nfsd4_setclientid(struct svc_rqst *rqst
        unsigned int            strhashval;
        struct nfs4_client      *conf, *unconf, *new;
        __be32                  status;
+       char                    *princ;
        char                    dname[HEXDIR_LEN];
        
        if (!check_name(clname))
                status = nfserr_clid_inuse;
                if (!same_creds(&conf->cl_cred, &rqstp->rq_cred)
                                || conf->cl_addr != sin->sin_addr.s_addr) {
 -                      dprintk("NFSD: setclientid: string in use by client"
 -                              "at %u.%u.%u.%u\n", NIPQUAD(conf->cl_addr));
 +                      dprintk("NFSD: setclientid: string in use by clientat %pI4\n",
 +                              &conf->cl_addr);
                        goto out;
                }
        }
        }
        copy_verf(new, &clverifier);
        new->cl_addr = sin->sin_addr.s_addr;
+       new->cl_flavor = rqstp->rq_flavor;
+       princ = svc_gss_principal(rqstp);
+       if (princ) {
+               new->cl_principal = kstrdup(princ, GFP_KERNEL);
+               if (new->cl_principal == NULL) {
+                       free_client(new);
+                       goto out;
+               }
+       }
        copy_cred(&new->cl_cred, &rqstp->rq_cred);
        gen_confirm(new);
        gen_callback(new, setclid);
diff --combined net/sunrpc/auth.c
index 0443f83494585a634dad0f0b55c75bd2401b7d4b,050e4e84d9e3c44a562618ca30d7a3eeb5e86535..0c431c277af5be352e3c65b9fa4de99e25086e9b
@@@ -234,7 -234,7 +234,7 @@@ rpcauth_prune_expired(struct list_head 
        list_for_each_entry_safe(cred, next, &cred_unused, cr_lru) {
  
                /* Enforce a 60 second garbage collection moratorium */
-               if (time_in_range(cred->cr_expire, expired, jiffies) &&
+               if (time_in_range_open(cred->cr_expire, expired, jiffies) &&
                    test_bit(RPCAUTH_CRED_HASHED, &cred->cr_flags) != 0)
                        continue;
  
@@@ -350,18 -350,16 +350,18 @@@ EXPORT_SYMBOL_GPL(rpcauth_lookup_credca
  struct rpc_cred *
  rpcauth_lookupcred(struct rpc_auth *auth, int flags)
  {
 -      struct auth_cred acred = {
 -              .uid = current->fsuid,
 -              .gid = current->fsgid,
 -              .group_info = current->group_info,
 -      };
 +      struct auth_cred acred;
        struct rpc_cred *ret;
 +      const struct cred *cred = current_cred();
  
        dprintk("RPC:       looking up %s cred\n",
                auth->au_ops->au_name);
 -      get_group_info(acred.group_info);
 +
 +      memset(&acred, 0, sizeof(acred));
 +      acred.uid = cred->fsuid;
 +      acred.gid = cred->fsgid;
 +      acred.group_info = get_group_info(((struct cred *)cred)->group_info);
 +
        ret = auth->au_ops->lookup_cred(auth, &acred, flags);
        put_group_info(acred.group_info);
        return ret;
@@@ -515,7 -513,7 +515,7 @@@ rpcauth_wrap_req(struct rpc_task *task
        if (cred->cr_ops->crwrap_req)
                return cred->cr_ops->crwrap_req(task, encode, rqstp, data, obj);
        /* By default, we encode the arguments normally. */
-       return rpc_call_xdrproc(encode, rqstp, data, obj);
+       return encode(rqstp, data, obj);
  }
  
  int
@@@ -530,7 -528,7 +530,7 @@@ rpcauth_unwrap_resp(struct rpc_task *ta
                return cred->cr_ops->crunwrap_resp(task, decode, rqstp,
                                                   data, obj);
        /* By default, we decode the arguments normally. */
-       return rpc_call_xdrproc(decode, rqstp, data, obj);
+       return decode(rqstp, data, obj);
  }
  
  int
diff --combined net/sunrpc/clnt.c
index 3ca518386d15d33959ea12a0fc1315d1e8499b98,347f2a25abb6e76a60c2268d7d54415202260578..836f15c0c4a3489b6e9d5ba5a7bfc59514a0db3d
@@@ -197,6 -197,12 +197,12 @@@ static struct rpc_clnt * rpc_new_client
  
        clnt->cl_rtt = &clnt->cl_rtt_default;
        rpc_init_rtt(&clnt->cl_rtt_default, clnt->cl_timeout->to_initval);
+       clnt->cl_principal = NULL;
+       if (args->client_name) {
+               clnt->cl_principal = kstrdup(args->client_name, GFP_KERNEL);
+               if (!clnt->cl_principal)
+                       goto out_no_principal;
+       }
  
        kref_init(&clnt->cl_kref);
  
@@@ -226,6 -232,8 +232,8 @@@ out_no_auth
                rpc_put_mount();
        }
  out_no_path:
+       kfree(clnt->cl_principal);
+ out_no_principal:
        rpc_free_iostats(clnt->cl_metrics);
  out_no_stats:
        if (clnt->cl_server != clnt->cl_inline_name)
@@@ -271,15 -279,15 +279,15 @@@ struct rpc_clnt *rpc_create(struct rpc_
                case AF_INET: {
                        struct sockaddr_in *sin =
                                        (struct sockaddr_in *)args->address;
 -                      snprintf(servername, sizeof(servername), NIPQUAD_FMT,
 -                               NIPQUAD(sin->sin_addr.s_addr));
 +                      snprintf(servername, sizeof(servername), "%pI4",
 +                               &sin->sin_addr.s_addr);
                        break;
                }
                case AF_INET6: {
                        struct sockaddr_in6 *sin =
                                        (struct sockaddr_in6 *)args->address;
 -                      snprintf(servername, sizeof(servername), NIP6_FMT,
 -                               NIP6(sin->sin6_addr));
 +                      snprintf(servername, sizeof(servername), "%pI6",
 +                               &sin->sin6_addr);
                        break;
                }
                default:
@@@ -354,6 -362,11 +362,11 @@@ rpc_clone_client(struct rpc_clnt *clnt
        new->cl_metrics = rpc_alloc_iostats(clnt);
        if (new->cl_metrics == NULL)
                goto out_no_stats;
+       if (clnt->cl_principal) {
+               new->cl_principal = kstrdup(clnt->cl_principal, GFP_KERNEL);
+               if (new->cl_principal == NULL)
+                       goto out_no_principal;
+       }
        kref_init(&new->cl_kref);
        err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name);
        if (err != 0)
        rpciod_up();
        return new;
  out_no_path:
+       kfree(new->cl_principal);
+ out_no_principal:
        rpc_free_iostats(new->cl_metrics);
  out_no_stats:
        kfree(new);
@@@ -417,6 -432,7 +432,7 @@@ rpc_free_client(struct kref *kref
  out_free:
        rpc_unregister_client(clnt);
        rpc_free_iostats(clnt->cl_metrics);
+       kfree(clnt->cl_principal);
        clnt->cl_metrics = NULL;
        xprt_put(clnt->cl_xprt);
        rpciod_down();