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

Commit 9e12a7e7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
  NFS: Propagate 'fsc' mount option through automounts
  sunrpc/rpc_pipe: fix kernel-doc notation
  sunrpc: xdr_xcode_hyper helpers cannot presume 64-bit alignment
  NFS: Add nfs_alloc_parsed_mount_data
  NFS/RPC: fix problems with reestablish_timeout and related code.
  NFS: Get rid of the NFS_MOUNT_VER3 and NFS_MOUNT_TCP flags
parents a7ddbf89 2df54806
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -648,8 +648,6 @@ static int nfs_start_lockd(struct nfs_server *server)
		.hostname	= clp->cl_hostname,
		.address	= (struct sockaddr *)&clp->cl_addr,
		.addrlen	= clp->cl_addrlen,
		.protocol	= server->flags & NFS_MOUNT_TCP ?
						IPPROTO_TCP : IPPROTO_UDP,
		.nfs_version	= clp->rpc_ops->version,
		.noresvport	= server->flags & NFS_MOUNT_NORESVPORT ?
					1 : 0,
@@ -660,6 +658,14 @@ static int nfs_start_lockd(struct nfs_server *server)
	if (server->flags & NFS_MOUNT_NONLM)
		return 0;

	switch (clp->cl_proto) {
		default:
			nlm_init.protocol = IPPROTO_TCP;
			break;
		case XPRT_TRANSPORT_UDP:
			nlm_init.protocol = IPPROTO_UDP;
	}

	host = nlmclnt_init(&nlm_init);
	if (IS_ERR(host))
		return PTR_ERR(host);
@@ -787,7 +793,7 @@ static int nfs_init_server(struct nfs_server *server,
	dprintk("--> nfs_init_server()\n");

#ifdef CONFIG_NFS_V3
	if (data->flags & NFS_MOUNT_VER3)
	if (data->version == 3)
		cl_init.rpc_ops = &nfs_v3_clientops;
#endif

@@ -964,6 +970,7 @@ static void nfs_server_copy_userdata(struct nfs_server *target, struct nfs_serve
	target->acdirmin = source->acdirmin;
	target->acdirmax = source->acdirmax;
	target->caps = source->caps;
	target->options = source->options;
}

/*
+21 −4
Original line number Diff line number Diff line
@@ -58,17 +58,34 @@ void nfs_fscache_release_client_cookie(struct nfs_client *clp)
/*
 * Get the cache cookie for an NFS superblock.  We have to handle
 * uniquification here because the cache doesn't do it for us.
 *
 * The default uniquifier is just an empty string, but it may be overridden
 * either by the 'fsc=xxx' option to mount, or by inheriting it from the parent
 * superblock across an automount point of some nature.
 */
void nfs_fscache_get_super_cookie(struct super_block *sb,
				  struct nfs_parsed_mount_data *data)
void nfs_fscache_get_super_cookie(struct super_block *sb, const char *uniq,
				  struct nfs_clone_mount *mntdata)
{
	struct nfs_fscache_key *key, *xkey;
	struct nfs_server *nfss = NFS_SB(sb);
	struct rb_node **p, *parent;
	const char *uniq = data->fscache_uniq ?: "";
	int diff, ulen;

	if (uniq) {
		ulen = strlen(uniq);
	} else if (mntdata) {
		struct nfs_server *mnt_s = NFS_SB(mntdata->sb);
		if (mnt_s->fscache_key) {
			uniq = mnt_s->fscache_key->key.uniquifier;
			ulen = mnt_s->fscache_key->key.uniq_len;
		}
	}

	if (!uniq) {
		uniq = "";
		ulen = 1;
	}

	key = kzalloc(sizeof(*key) + ulen, GFP_KERNEL);
	if (!key)
		return;
+4 −2
Original line number Diff line number Diff line
@@ -74,7 +74,8 @@ extern void nfs_fscache_get_client_cookie(struct nfs_client *);
extern void nfs_fscache_release_client_cookie(struct nfs_client *);

extern void nfs_fscache_get_super_cookie(struct super_block *,
					 struct nfs_parsed_mount_data *);
					 const char *,
					 struct nfs_clone_mount *);
extern void nfs_fscache_release_super_cookie(struct super_block *);

extern void nfs_fscache_init_inode_cookie(struct inode *);
@@ -173,7 +174,8 @@ static inline void nfs_fscache_release_client_cookie(struct nfs_client *clp) {}

static inline void nfs_fscache_get_super_cookie(
	struct super_block *sb,
	struct nfs_parsed_mount_data *data)
	const char *uniq,
	struct nfs_clone_mount *mntdata)
{
}
static inline void nfs_fscache_release_super_cookie(struct super_block *sb) {}
+40 −36
Original line number Diff line number Diff line
@@ -728,6 +728,27 @@ static void nfs_umount_begin(struct super_block *sb)
	unlock_kernel();
}

static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(int flags)
{
	struct nfs_parsed_mount_data *data;

	data = kzalloc(sizeof(*data), GFP_KERNEL);
	if (data) {
		data->flags		= flags;
		data->rsize		= NFS_MAX_FILE_IO_SIZE;
		data->wsize		= NFS_MAX_FILE_IO_SIZE;
		data->acregmin		= NFS_DEF_ACREGMIN;
		data->acregmax		= NFS_DEF_ACREGMAX;
		data->acdirmin		= NFS_DEF_ACDIRMIN;
		data->acdirmax		= NFS_DEF_ACDIRMAX;
		data->nfs_server.port	= NFS_UNSPEC_PORT;
		data->auth_flavors[0]	= RPC_AUTH_UNIX;
		data->auth_flavor_len	= 1;
		data->minorversion	= 0;
	}
	return data;
}

/*
 * Sanity-check a server address provided by the mount command.
 *
@@ -1430,11 +1451,14 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
	int status;

	if (args->mount_server.version == 0) {
		if (args->flags & NFS_MOUNT_VER3)
		switch (args->version) {
			default:
				args->mount_server.version = NFS_MNT3_VERSION;
		else
				break;
			case 2:
				args->mount_server.version = NFS_MNT_VERSION;
		}
	}
	request.version = args->mount_server.version;

	if (args->mount_server.hostname)
@@ -1634,20 +1658,6 @@ static int nfs_validate_mount_data(void *options,
	if (data == NULL)
		goto out_no_data;

	args->flags		= (NFS_MOUNT_VER3 | NFS_MOUNT_TCP);
	args->rsize		= NFS_MAX_FILE_IO_SIZE;
	args->wsize		= NFS_MAX_FILE_IO_SIZE;
	args->acregmin		= NFS_DEF_ACREGMIN;
	args->acregmax		= NFS_DEF_ACREGMAX;
	args->acdirmin		= NFS_DEF_ACDIRMIN;
	args->acdirmax		= NFS_DEF_ACDIRMAX;
	args->mount_server.port	= NFS_UNSPEC_PORT;
	args->nfs_server.port	= NFS_UNSPEC_PORT;
	args->nfs_server.protocol = XPRT_TRANSPORT_TCP;
	args->auth_flavors[0]	= RPC_AUTH_UNIX;
	args->auth_flavor_len	= 1;
	args->minorversion	= 0;

	switch (data->version) {
	case 1:
		data->namlen = 0;
@@ -1778,7 +1788,7 @@ static int nfs_validate_mount_data(void *options,
	}

#ifndef CONFIG_NFS_V3
	if (args->flags & NFS_MOUNT_VER3)
	if (args->version == 3)
		goto out_v3_not_compiled;
#endif /* !CONFIG_NFS_V3 */

@@ -1936,7 +1946,7 @@ static void nfs_fill_super(struct super_block *sb,
	if (data->bsize)
		sb->s_blocksize = nfs_block_size(data->bsize, &sb->s_blocksize_bits);

	if (server->flags & NFS_MOUNT_VER3) {
	if (server->nfs_client->rpc_ops->version == 3) {
		/* The VFS shouldn't apply the umask to mode bits. We will do
		 * so ourselves when necessary.
		 */
@@ -1960,7 +1970,7 @@ static void nfs_clone_super(struct super_block *sb,
	sb->s_blocksize = old_sb->s_blocksize;
	sb->s_maxbytes = old_sb->s_maxbytes;

	if (server->flags & NFS_MOUNT_VER3) {
	if (server->nfs_client->rpc_ops->version == 3) {
		/* The VFS shouldn't apply the umask to mode bits. We will do
		 * so ourselves when necessary.
		 */
@@ -2094,7 +2104,7 @@ static int nfs_get_sb(struct file_system_type *fs_type,
	};
	int error = -ENOMEM;

	data = kzalloc(sizeof(*data), GFP_KERNEL);
	data = nfs_alloc_parsed_mount_data(NFS_MOUNT_VER3 | NFS_MOUNT_TCP);
	mntfh = kzalloc(sizeof(*mntfh), GFP_KERNEL);
	if (data == NULL || mntfh == NULL)
		goto out_free_fh;
@@ -2144,7 +2154,8 @@ static int nfs_get_sb(struct file_system_type *fs_type,
	if (!s->s_root) {
		/* initial superblock/root creation */
		nfs_fill_super(s, data);
		nfs_fscache_get_super_cookie(s, data);
		nfs_fscache_get_super_cookie(
			s, data ? data->fscache_uniq : NULL, NULL);
	}

	mntroot = nfs_get_root(s, mntfh);
@@ -2245,6 +2256,7 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
	if (!s->s_root) {
		/* initial superblock/root creation */
		nfs_clone_super(s, data->sb);
		nfs_fscache_get_super_cookie(s, NULL, data);
	}

	mntroot = nfs_get_root(s, data->fh);
@@ -2362,18 +2374,7 @@ static int nfs4_validate_mount_data(void *options,
	if (data == NULL)
		goto out_no_data;

	args->rsize		= NFS_MAX_FILE_IO_SIZE;
	args->wsize		= NFS_MAX_FILE_IO_SIZE;
	args->acregmin		= NFS_DEF_ACREGMIN;
	args->acregmax		= NFS_DEF_ACREGMAX;
	args->acdirmin		= NFS_DEF_ACDIRMIN;
	args->acdirmax		= NFS_DEF_ACDIRMAX;
	args->nfs_server.port	= NFS_UNSPEC_PORT;
	args->auth_flavors[0]	= RPC_AUTH_UNIX;
	args->auth_flavor_len	= 1;
	args->version		= 4;
	args->minorversion	= 0;

	switch (data->version) {
	case 1:
		if (data->host_addrlen > sizeof(args->nfs_server.address))
@@ -2508,7 +2509,8 @@ static int nfs4_remote_get_sb(struct file_system_type *fs_type,
	if (!s->s_root) {
		/* initial superblock/root creation */
		nfs4_fill_super(s);
		nfs_fscache_get_super_cookie(s, data);
		nfs_fscache_get_super_cookie(
			s, data ? data->fscache_uniq : NULL, NULL);
	}

	mntroot = nfs4_get_root(s, mntfh);
@@ -2656,7 +2658,7 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
	struct nfs_parsed_mount_data *data;
	int error = -ENOMEM;

	data = kzalloc(sizeof(*data), GFP_KERNEL);
	data = nfs_alloc_parsed_mount_data(0);
	if (data == NULL)
		goto out_free_data;

@@ -2741,6 +2743,7 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
	if (!s->s_root) {
		/* initial superblock/root creation */
		nfs4_clone_super(s, data->sb);
		nfs_fscache_get_super_cookie(s, NULL, data);
	}

	mntroot = nfs4_get_root(s, data->fh);
@@ -2822,6 +2825,7 @@ static int nfs4_remote_referral_get_sb(struct file_system_type *fs_type,
	if (!s->s_root) {
		/* initial superblock/root creation */
		nfs4_fill_super(s);
		nfs_fscache_get_super_cookie(s, NULL, data);
	}

	mntroot = nfs4_get_root(s, &mntfh);
+3 −2
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@

#include <linux/uio.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
#include <linux/scatterlist.h>

/*
@@ -117,14 +118,14 @@ static inline __be32 *xdr_encode_array(__be32 *p, const void *s, unsigned int le
static inline __be32 *
xdr_encode_hyper(__be32 *p, __u64 val)
{
	*(__be64 *)p = cpu_to_be64(val);
	put_unaligned_be64(val, p);
	return p + 2;
}

static inline __be32 *
xdr_decode_hyper(__be32 *p, __u64 *valp)
{
	*valp = be64_to_cpup((__be64 *)p);
	*valp = get_unaligned_be64(p);
	return p + 2;
}

Loading