Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16cefa8c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.linux-nfs.org/pub/linux/nfs-2.6: (122 commits)
  sunrpc: drop BKL around wrap and unwrap
  NFSv4: Make sure unlock is really an unlock when cancelling a lock
  NLM: fix source address of callback to client
  SUNRPC client: add interface for binding to a local address
  SUNRPC server: record the destination address of a request
  SUNRPC: cleanup transport creation argument passing
  NFSv4: Make the NFS state model work with the nosharedcache mount option
  NFS: Error when mounting the same filesystem with different options
  NFS: Add the mount option "nosharecache"
  NFS: Add support for mounting NFSv4 file systems with string options
  NFS: Add final pieces to support in-kernel mount option parsing
  NFS: Introduce generic mount client API
  NFS: Add enums and match tables for mount option parsing
  NFS: Improve debugging output in NFS in-kernel mount client
  NFS: Clean up in-kernel NFS mount
  NFS: Remake nfsroot_mount as a permanent part of NFS client
  SUNRPC: Add a convenient default for the hostname when calling rpc_create()
  SUNRPC: Rename rpcb_getport to be consistent with new rpcb_getport_sync name
  SUNRPC: Rename rpcb_getport_external routine
  SUNRPC: Allow rpcbind requests to be interrupted by a signal.
  ...
parents 4fbef206 d8558f99
Loading
Loading
Loading
Loading
+22 −17
Original line number Original line Diff line number Diff line
@@ -44,9 +44,8 @@ static struct nsm_handle * nsm_find(const struct sockaddr_in *sin,
 */
 */
static struct nlm_host *
static struct nlm_host *
nlm_lookup_host(int server, const struct sockaddr_in *sin,
nlm_lookup_host(int server, const struct sockaddr_in *sin,
					int proto, int version,
		int proto, int version, const char *hostname,
					const char *hostname,
		int hostname_len, const struct sockaddr_in *ssin)
					int hostname_len)
{
{
	struct hlist_head *chain;
	struct hlist_head *chain;
	struct hlist_node *pos;
	struct hlist_node *pos;
@@ -54,7 +53,9 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
	struct nsm_handle *nsm = NULL;
	struct nsm_handle *nsm = NULL;
	int		hash;
	int		hash;


	dprintk("lockd: nlm_lookup_host(%u.%u.%u.%u, p=%d, v=%d, my role=%s, name=%.*s)\n",
	dprintk("lockd: nlm_lookup_host("NIPQUAD_FMT"->"NIPQUAD_FMT
			", p=%d, v=%d, my role=%s, name=%.*s)\n",
			NIPQUAD(ssin->sin_addr.s_addr),
			NIPQUAD(sin->sin_addr.s_addr), proto, version,
			NIPQUAD(sin->sin_addr.s_addr), proto, version,
			server? "server" : "client",
			server? "server" : "client",
			hostname_len,
			hostname_len,
@@ -91,6 +92,8 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
			continue;
			continue;
		if (host->h_server != server)
		if (host->h_server != server)
			continue;
			continue;
		if (!nlm_cmp_addr(&host->h_saddr, ssin))
			continue;


		/* Move to head of hash chain. */
		/* Move to head of hash chain. */
		hlist_del(&host->h_hash);
		hlist_del(&host->h_hash);
@@ -118,6 +121,7 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
	host->h_name	   = nsm->sm_name;
	host->h_name	   = nsm->sm_name;
	host->h_addr       = *sin;
	host->h_addr       = *sin;
	host->h_addr.sin_port = 0;	/* ouch! */
	host->h_addr.sin_port = 0;	/* ouch! */
	host->h_saddr	   = *ssin;
	host->h_version    = version;
	host->h_version    = version;
	host->h_proto      = proto;
	host->h_proto      = proto;
	host->h_rpcclnt    = NULL;
	host->h_rpcclnt    = NULL;
@@ -161,15 +165,9 @@ nlm_destroy_host(struct nlm_host *host)
	 */
	 */
	nsm_unmonitor(host);
	nsm_unmonitor(host);


	if ((clnt = host->h_rpcclnt) != NULL) {
	clnt = host->h_rpcclnt;
		if (atomic_read(&clnt->cl_users)) {
	if (clnt != NULL)
			printk(KERN_WARNING
		rpc_shutdown_client(clnt);
				"lockd: active RPC handle\n");
			clnt->cl_dead = 1;
		} else {
			rpc_destroy_client(host->h_rpcclnt);
		}
	}
	kfree(host);
	kfree(host);
}
}


@@ -180,8 +178,10 @@ struct nlm_host *
nlmclnt_lookup_host(const struct sockaddr_in *sin, int proto, int version,
nlmclnt_lookup_host(const struct sockaddr_in *sin, int proto, int version,
			const char *hostname, int hostname_len)
			const char *hostname, int hostname_len)
{
{
	struct sockaddr_in ssin = {0};

	return nlm_lookup_host(0, sin, proto, version,
	return nlm_lookup_host(0, sin, proto, version,
			       hostname, hostname_len);
			       hostname, hostname_len, &ssin);
}
}


/*
/*
@@ -191,9 +191,12 @@ struct nlm_host *
nlmsvc_lookup_host(struct svc_rqst *rqstp,
nlmsvc_lookup_host(struct svc_rqst *rqstp,
			const char *hostname, int hostname_len)
			const char *hostname, int hostname_len)
{
{
	struct sockaddr_in ssin = {0};

	ssin.sin_addr = rqstp->rq_daddr.addr;
	return nlm_lookup_host(1, svc_addr_in(rqstp),
	return nlm_lookup_host(1, svc_addr_in(rqstp),
			       rqstp->rq_prot, rqstp->rq_vers,
			       rqstp->rq_prot, rqstp->rq_vers,
			       hostname, hostname_len);
			       hostname, hostname_len, &ssin);
}
}


/*
/*
@@ -204,8 +207,9 @@ nlm_bind_host(struct nlm_host *host)
{
{
	struct rpc_clnt	*clnt;
	struct rpc_clnt	*clnt;


	dprintk("lockd: nlm_bind_host(%08x)\n",
	dprintk("lockd: nlm_bind_host("NIPQUAD_FMT"->"NIPQUAD_FMT")\n",
			(unsigned)ntohl(host->h_addr.sin_addr.s_addr));
			NIPQUAD(host->h_saddr.sin_addr),
			NIPQUAD(host->h_addr.sin_addr));


	/* Lock host handle */
	/* Lock host handle */
	mutex_lock(&host->h_mutex);
	mutex_lock(&host->h_mutex);
@@ -232,6 +236,7 @@ nlm_bind_host(struct nlm_host *host)
			.protocol	= host->h_proto,
			.protocol	= host->h_proto,
			.address	= (struct sockaddr *)&host->h_addr,
			.address	= (struct sockaddr *)&host->h_addr,
			.addrsize	= sizeof(host->h_addr),
			.addrsize	= sizeof(host->h_addr),
			.saddress	= (struct sockaddr *)&host->h_saddr,
			.timeout	= &timeparms,
			.timeout	= &timeparms,
			.servername	= host->h_name,
			.servername	= host->h_name,
			.program	= &nlm_program,
			.program	= &nlm_program,
+1 −1
Original line number Original line Diff line number Diff line
@@ -61,6 +61,7 @@ nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
			status);
			status);
	else
	else
		status = 0;
		status = 0;
	rpc_shutdown_client(clnt);
 out:
 out:
	return status;
	return status;
}
}
@@ -138,7 +139,6 @@ nsm_create(void)
		.program	= &nsm_program,
		.program	= &nsm_program,
		.version	= SM_VERSION,
		.version	= SM_VERSION,
		.authflavor	= RPC_AUTH_NULL,
		.authflavor	= RPC_AUTH_NULL,
		.flags		= (RPC_CLNT_CREATE_ONESHOT),
	};
	};


	return rpc_create(&args);
	return rpc_create(&args);
+0 −6
Original line number Original line Diff line number Diff line
@@ -123,9 +123,6 @@ lockd(struct svc_rqst *rqstp)
	/* Process request with signals blocked, but allow SIGKILL.  */
	/* Process request with signals blocked, but allow SIGKILL.  */
	allow_signal(SIGKILL);
	allow_signal(SIGKILL);


	/* kick rpciod */
	rpciod_up();

	dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n");
	dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n");


	if (!nlm_timeout)
	if (!nlm_timeout)
@@ -202,9 +199,6 @@ lockd(struct svc_rqst *rqstp)
	/* Exit the RPC thread */
	/* Exit the RPC thread */
	svc_exit_thread(rqstp);
	svc_exit_thread(rqstp);


	/* release rpciod */
	rpciod_down();

	/* Release module */
	/* Release module */
	unlock_kernel();
	unlock_kernel();
	module_put_and_exit(0);
	module_put_and_exit(0);
+2 −2
Original line number Original line Diff line number Diff line
@@ -6,8 +6,8 @@ obj-$(CONFIG_NFS_FS) += nfs.o


nfs-y 			:= client.o dir.o file.o getroot.o inode.o super.o nfs2xdr.o \
nfs-y 			:= client.o dir.o file.o getroot.o inode.o super.o nfs2xdr.o \
			   pagelist.o proc.o read.o symlink.o unlink.o \
			   pagelist.o proc.o read.o symlink.o unlink.o \
			   write.o namespace.o
			   write.o namespace.o mount_clnt.o
nfs-$(CONFIG_ROOT_NFS)	+= nfsroot.o mount_clnt.o      
nfs-$(CONFIG_ROOT_NFS)	+= nfsroot.o
nfs-$(CONFIG_NFS_V3)	+= nfs3proc.o nfs3xdr.o
nfs-$(CONFIG_NFS_V3)	+= nfs3proc.o nfs3xdr.o
nfs-$(CONFIG_NFS_V3_ACL)	+= nfs3acl.o
nfs-$(CONFIG_NFS_V3_ACL)	+= nfs3acl.o
nfs-$(CONFIG_NFS_V4)	+= nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \
nfs-$(CONFIG_NFS_V4)	+= nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \
+1 −27
Original line number Original line Diff line number Diff line
@@ -102,19 +102,10 @@ static struct nfs_client *nfs_alloc_client(const char *hostname,
					   int nfsversion)
					   int nfsversion)
{
{
	struct nfs_client *clp;
	struct nfs_client *clp;
	int error;


	if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL)
	if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL)
		goto error_0;
		goto error_0;


	error = rpciod_up();
	if (error < 0) {
		dprintk("%s: couldn't start rpciod! Error = %d\n",
				__FUNCTION__, error);
		goto error_1;
	}
	__set_bit(NFS_CS_RPCIOD, &clp->cl_res_state);

	if (nfsversion == 4) {
	if (nfsversion == 4) {
		if (nfs_callback_up() < 0)
		if (nfs_callback_up() < 0)
			goto error_2;
			goto error_2;
@@ -139,8 +130,6 @@ static struct nfs_client *nfs_alloc_client(const char *hostname,
#ifdef CONFIG_NFS_V4
#ifdef CONFIG_NFS_V4
	init_rwsem(&clp->cl_sem);
	init_rwsem(&clp->cl_sem);
	INIT_LIST_HEAD(&clp->cl_delegations);
	INIT_LIST_HEAD(&clp->cl_delegations);
	INIT_LIST_HEAD(&clp->cl_state_owners);
	INIT_LIST_HEAD(&clp->cl_unused);
	spin_lock_init(&clp->cl_lock);
	spin_lock_init(&clp->cl_lock);
	INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state);
	INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state);
	rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
	rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client");
@@ -154,9 +143,6 @@ error_3:
	if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
	if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
		nfs_callback_down();
		nfs_callback_down();
error_2:
error_2:
	rpciod_down();
	__clear_bit(NFS_CS_RPCIOD, &clp->cl_res_state);
error_1:
	kfree(clp);
	kfree(clp);
error_0:
error_0:
	return NULL;
	return NULL;
@@ -167,16 +153,7 @@ static void nfs4_shutdown_client(struct nfs_client *clp)
#ifdef CONFIG_NFS_V4
#ifdef CONFIG_NFS_V4
	if (__test_and_clear_bit(NFS_CS_RENEWD, &clp->cl_res_state))
	if (__test_and_clear_bit(NFS_CS_RENEWD, &clp->cl_res_state))
		nfs4_kill_renewd(clp);
		nfs4_kill_renewd(clp);
	while (!list_empty(&clp->cl_unused)) {
	BUG_ON(!RB_EMPTY_ROOT(&clp->cl_state_owners));
		struct nfs4_state_owner *sp;

		sp = list_entry(clp->cl_unused.next,
				struct nfs4_state_owner,
				so_list);
		list_del(&sp->so_list);
		kfree(sp);
	}
	BUG_ON(!list_empty(&clp->cl_state_owners));
	if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state))
	if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state))
		nfs_idmap_delete(clp);
		nfs_idmap_delete(clp);
#endif
#endif
@@ -198,9 +175,6 @@ static void nfs_free_client(struct nfs_client *clp)
	if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
	if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state))
		nfs_callback_down();
		nfs_callback_down();


	if (__test_and_clear_bit(NFS_CS_RPCIOD, &clp->cl_res_state))
		rpciod_down();

	kfree(clp->cl_hostname);
	kfree(clp->cl_hostname);
	kfree(clp);
	kfree(clp);


Loading