Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://linux-nfs.org/~bfields/linux
Browse files Browse the repository at this point in the history
* 'for-linus' of git://linux-nfs.org/~bfields/linux: (100 commits)
  SUNRPC: RPC program information is stored in unsigned integers
  SUNRPC: Move exported symbol definitions after function declaration part 2
  NLM: tear down RPC clients in nlm_shutdown_hosts
  SUNRPC: spin svc_rqst initialization to its own function
  nfsd: more careful input validation in nfsctl write methods
  lockd: minor log message fix
  knfsd: don't bother mapping putrootfh enoent to eperm
  rdma: makefile
  rdma: ONCRPC RDMA protocol marshalling
  rdma: SVCRDMA sendto
  rdma: SVCRDMA recvfrom
  rdma: SVCRDMA Core Transport Services
  rdma: SVCRDMA Transport Module
  rdma: SVCRMDA Header File
  svc: Add svc_xprt_names service to replace svc_sock_names
  knfsd: Support adding transports by writing portlist file
  svc: Add svc API that queries for a transport instance
  svc: Add /proc/sys/sunrpc/transport files
  svc: Add transport hdr size for defer/revisit
  svc: Move the xprt independent code to the svc_xprt.c file
  ...
  • Loading branch information
torvalds committed Feb 2, 2008
2 parents 687fcdf + ea339d4 commit 63e9b66
Show file tree
Hide file tree
Showing 60 changed files with 5,450 additions and 1,664 deletions.
2 changes: 1 addition & 1 deletion MAINTAINERS
Expand Up @@ -2247,7 +2247,7 @@ P: J. Bruce Fields
M: bfields@fieldses.org
P: Neil Brown
M: neilb@suse.de
L: nfs@lists.sourceforge.net
L: linux-nfs@vger.kernel.org
W: http://nfs.sourceforge.net/
S: Supported

Expand Down
2 changes: 2 additions & 0 deletions fs/Kconfig
Expand Up @@ -1674,6 +1674,8 @@ config NFSD
select CRYPTO_MD5 if NFSD_V4
select CRYPTO if NFSD_V4
select FS_POSIX_ACL if NFSD_V4
select PROC_FS if NFSD_V4
select PROC_FS if SUNRPC_GSS
help
If you want your Linux box to act as an NFS *server*, so that other
computers on your local network which support NFS can access certain
Expand Down
26 changes: 17 additions & 9 deletions fs/lockd/host.c
Expand Up @@ -34,18 +34,19 @@ static DEFINE_MUTEX(nlm_host_mutex);

static void nlm_gc_hosts(void);
static struct nsm_handle * __nsm_find(const struct sockaddr_in *,
const char *, int, int);
const char *, unsigned int, int);
static struct nsm_handle * nsm_find(const struct sockaddr_in *sin,
const char *hostname,
int hostname_len);
unsigned int hostname_len);

/*
* Common host lookup routine for server & client
*/
static struct nlm_host *
nlm_lookup_host(int server, const struct sockaddr_in *sin,
int proto, int version, const char *hostname,
int hostname_len, const struct sockaddr_in *ssin)
unsigned int hostname_len,
const struct sockaddr_in *ssin)
{
struct hlist_head *chain;
struct hlist_node *pos;
Expand Down Expand Up @@ -176,7 +177,7 @@ nlm_destroy_host(struct nlm_host *host)
*/
struct nlm_host *
nlmclnt_lookup_host(const struct sockaddr_in *sin, int proto, int version,
const char *hostname, int hostname_len)
const char *hostname, unsigned int hostname_len)
{
struct sockaddr_in ssin = {0};

Expand All @@ -189,7 +190,7 @@ nlmclnt_lookup_host(const struct sockaddr_in *sin, int proto, int version,
*/
struct nlm_host *
nlmsvc_lookup_host(struct svc_rqst *rqstp,
const char *hostname, int hostname_len)
const char *hostname, unsigned int hostname_len)
{
struct sockaddr_in ssin = {0};

Expand Down Expand Up @@ -307,7 +308,8 @@ void nlm_release_host(struct nlm_host *host)
* Release all resources held by that peer.
*/
void nlm_host_rebooted(const struct sockaddr_in *sin,
const char *hostname, int hostname_len,
const char *hostname,
unsigned int hostname_len,
u32 new_state)
{
struct hlist_head *chain;
Expand Down Expand Up @@ -377,8 +379,13 @@ nlm_shutdown_hosts(void)
/* First, make all hosts eligible for gc */
dprintk("lockd: nuking all hosts...\n");
for (chain = nlm_hosts; chain < nlm_hosts + NLM_HOST_NRHASH; ++chain) {
hlist_for_each_entry(host, pos, chain, h_hash)
hlist_for_each_entry(host, pos, chain, h_hash) {
host->h_expires = jiffies - 1;
if (host->h_rpcclnt) {
rpc_shutdown_client(host->h_rpcclnt);
host->h_rpcclnt = NULL;
}
}
}

/* Then, perform a garbage collection pass */
Expand Down Expand Up @@ -449,7 +456,7 @@ static DEFINE_MUTEX(nsm_mutex);

static struct nsm_handle *
__nsm_find(const struct sockaddr_in *sin,
const char *hostname, int hostname_len,
const char *hostname, unsigned int hostname_len,
int create)
{
struct nsm_handle *nsm = NULL;
Expand Down Expand Up @@ -503,7 +510,8 @@ __nsm_find(const struct sockaddr_in *sin,
}

static struct nsm_handle *
nsm_find(const struct sockaddr_in *sin, const char *hostname, int hostname_len)
nsm_find(const struct sockaddr_in *sin, const char *hostname,
unsigned int hostname_len)
{
return __nsm_find(sin, hostname, hostname_len, 1);
}
Expand Down
39 changes: 17 additions & 22 deletions fs/lockd/svc.c
Expand Up @@ -219,19 +219,6 @@ lockd(struct svc_rqst *rqstp)
module_put_and_exit(0);
}


static int find_socket(struct svc_serv *serv, int proto)
{
struct svc_sock *svsk;
int found = 0;
list_for_each_entry(svsk, &serv->sv_permsocks, sk_list)
if (svsk->sk_sk->sk_protocol == proto) {
found = 1;
break;
}
return found;
}

/*
* Make any sockets that are needed but not present.
* If nlm_udpport or nlm_tcpport were set as module
Expand All @@ -240,17 +227,25 @@ static int find_socket(struct svc_serv *serv, int proto)
static int make_socks(struct svc_serv *serv, int proto)
{
static int warned;
struct svc_xprt *xprt;
int err = 0;

if (proto == IPPROTO_UDP || nlm_udpport)
if (!find_socket(serv, IPPROTO_UDP))
err = svc_makesock(serv, IPPROTO_UDP, nlm_udpport,
SVC_SOCK_DEFAULTS);
if (err >= 0 && (proto == IPPROTO_TCP || nlm_tcpport))
if (!find_socket(serv, IPPROTO_TCP))
err = svc_makesock(serv, IPPROTO_TCP, nlm_tcpport,
SVC_SOCK_DEFAULTS);

if (proto == IPPROTO_UDP || nlm_udpport) {
xprt = svc_find_xprt(serv, "udp", 0, 0);
if (!xprt)
err = svc_create_xprt(serv, "udp", nlm_udpport,
SVC_SOCK_DEFAULTS);
else
svc_xprt_put(xprt);
}
if (err >= 0 && (proto == IPPROTO_TCP || nlm_tcpport)) {
xprt = svc_find_xprt(serv, "tcp", 0, 0);
if (!xprt)
err = svc_create_xprt(serv, "tcp", nlm_tcpport,
SVC_SOCK_DEFAULTS);
else
svc_xprt_put(xprt);
}
if (err >= 0) {
warned = 0;
err = 0;
Expand Down
20 changes: 12 additions & 8 deletions fs/lockd/svc4proc.c
Expand Up @@ -84,14 +84,15 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
{
struct nlm_host *host;
struct nlm_file *file;
int rc = rpc_success;

dprintk("lockd: TEST4 called\n");
resp->cookie = argp->cookie;

/* Don't accept test requests during grace period */
if (nlmsvc_grace_period) {
resp->status = nlm_lck_denied_grace_period;
return rpc_success;
return rc;
}

/* Obtain client and file */
Expand All @@ -101,12 +102,13 @@ nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
/* Now check for conflicting locks */
resp->status = nlmsvc_testlock(rqstp, file, &argp->lock, &resp->lock, &resp->cookie);
if (resp->status == nlm_drop_reply)
return rpc_drop_reply;
rc = rpc_drop_reply;
else
dprintk("lockd: TEST4 status %d\n", ntohl(resp->status));

dprintk("lockd: TEST4 status %d\n", ntohl(resp->status));
nlm_release_host(host);
nlm_release_file(file);
return rpc_success;
return rc;
}

static __be32
Expand All @@ -115,6 +117,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
{
struct nlm_host *host;
struct nlm_file *file;
int rc = rpc_success;

dprintk("lockd: LOCK called\n");

Expand All @@ -123,7 +126,7 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
/* Don't accept new lock requests during grace period */
if (nlmsvc_grace_period && !argp->reclaim) {
resp->status = nlm_lck_denied_grace_period;
return rpc_success;
return rc;
}

/* Obtain client and file */
Expand All @@ -146,12 +149,13 @@ nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
resp->status = nlmsvc_lock(rqstp, file, &argp->lock,
argp->block, &argp->cookie);
if (resp->status == nlm_drop_reply)
return rpc_drop_reply;
rc = rpc_drop_reply;
else
dprintk("lockd: LOCK status %d\n", ntohl(resp->status));

dprintk("lockd: LOCK status %d\n", ntohl(resp->status));
nlm_release_host(host);
nlm_release_file(file);
return rpc_success;
return rc;
}

static __be32
Expand Down
20 changes: 12 additions & 8 deletions fs/lockd/svclock.c
Expand Up @@ -501,25 +501,29 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
block, block->b_flags, block->b_fl);
if (block->b_flags & B_TIMED_OUT) {
nlmsvc_unlink_block(block);
return nlm_lck_denied;
ret = nlm_lck_denied;
goto out;
}
if (block->b_flags & B_GOT_CALLBACK) {
nlmsvc_unlink_block(block);
if (block->b_fl != NULL
&& block->b_fl->fl_type != F_UNLCK) {
lock->fl = *block->b_fl;
goto conf_lock;
}
else {
nlmsvc_unlink_block(block);
return nlm_granted;
} else {
ret = nlm_granted;
goto out;
}
}
return nlm_drop_reply;
ret = nlm_drop_reply;
goto out;
}

error = vfs_test_lock(file->f_file, &lock->fl);
if (error == -EINPROGRESS)
return nlmsvc_defer_lock_rqst(rqstp, block);
if (error == -EINPROGRESS) {
ret = nlmsvc_defer_lock_rqst(rqstp, block);
goto out;
}
if (error) {
ret = nlm_lck_denied_nolocks;
goto out;
Expand Down
22 changes: 13 additions & 9 deletions fs/lockd/svcproc.c
Expand Up @@ -113,14 +113,15 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
{
struct nlm_host *host;
struct nlm_file *file;
int rc = rpc_success;

dprintk("lockd: TEST called\n");
resp->cookie = argp->cookie;

/* Don't accept test requests during grace period */
if (nlmsvc_grace_period) {
resp->status = nlm_lck_denied_grace_period;
return rpc_success;
return rc;
}

/* Obtain client and file */
Expand All @@ -130,13 +131,14 @@ nlmsvc_proc_test(struct svc_rqst *rqstp, struct nlm_args *argp,
/* Now check for conflicting locks */
resp->status = cast_status(nlmsvc_testlock(rqstp, file, &argp->lock, &resp->lock, &resp->cookie));
if (resp->status == nlm_drop_reply)
return rpc_drop_reply;
rc = rpc_drop_reply;
else
dprintk("lockd: TEST status %d vers %d\n",
ntohl(resp->status), rqstp->rq_vers);

dprintk("lockd: TEST status %d vers %d\n",
ntohl(resp->status), rqstp->rq_vers);
nlm_release_host(host);
nlm_release_file(file);
return rpc_success;
return rc;
}

static __be32
Expand All @@ -145,6 +147,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
{
struct nlm_host *host;
struct nlm_file *file;
int rc = rpc_success;

dprintk("lockd: LOCK called\n");

Expand All @@ -153,7 +156,7 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
/* Don't accept new lock requests during grace period */
if (nlmsvc_grace_period && !argp->reclaim) {
resp->status = nlm_lck_denied_grace_period;
return rpc_success;
return rc;
}

/* Obtain client and file */
Expand All @@ -176,12 +179,13 @@ nlmsvc_proc_lock(struct svc_rqst *rqstp, struct nlm_args *argp,
resp->status = cast_status(nlmsvc_lock(rqstp, file, &argp->lock,
argp->block, &argp->cookie));
if (resp->status == nlm_drop_reply)
return rpc_drop_reply;
rc = rpc_drop_reply;
else
dprintk("lockd: LOCK status %d\n", ntohl(resp->status));

dprintk("lockd: LOCK status %d\n", ntohl(resp->status));
nlm_release_host(host);
nlm_release_file(file);
return rpc_success;
return rc;
}

static __be32
Expand Down
2 changes: 1 addition & 1 deletion fs/lockd/svcsubs.c
Expand Up @@ -87,7 +87,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result,
unsigned int hash;
__be32 nfserr;

nlm_debug_print_fh("nlm_file_lookup", f);
nlm_debug_print_fh("nlm_lookup_file", f);

hash = file_hash(f);

Expand Down
4 changes: 2 additions & 2 deletions fs/nfs/callback.c
Expand Up @@ -119,8 +119,8 @@ int nfs_callback_up(void)
if (!serv)
goto out_err;

ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport,
SVC_SOCK_ANONYMOUS);
ret = svc_create_xprt(serv, "tcp", nfs_callback_set_tcpport,
SVC_SOCK_ANONYMOUS);
if (ret <= 0)
goto out_destroy;
nfs_callback_tcpport = ret;
Expand Down
5 changes: 0 additions & 5 deletions include/linux/nfsd/auth.h → fs/nfsd/auth.h
@@ -1,6 +1,4 @@
/*
* include/linux/nfsd/auth.h
*
* nfsd-specific authentication stuff.
* uid/gid mapping not yet implemented.
*
Expand All @@ -10,8 +8,6 @@
#ifndef LINUX_NFSD_AUTH_H
#define LINUX_NFSD_AUTH_H

#ifdef __KERNEL__

#define nfsd_luid(rq, uid) ((u32)(uid))
#define nfsd_lgid(rq, gid) ((u32)(gid))
#define nfsd_ruid(rq, uid) ((u32)(uid))
Expand All @@ -23,5 +19,4 @@
*/
int nfsd_setuser(struct svc_rqst *, struct svc_export *);

#endif /* __KERNEL__ */
#endif /* LINUX_NFSD_AUTH_H */

0 comments on commit 63e9b66

Please sign in to comment.