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

Commit c239d83b authored by Stanislav Kinsbursky's avatar Stanislav Kinsbursky Committed by Trond Myklebust
Browse files

SUNRPC: split SUNPRC PipeFS dentry and private pipe data creation



This patch is a final step towards to removing PipeFS inode references from
kernel code other than PipeFS itself. It makes all kernel SUNRPC PipeFS users
depends on pipe private data, which state depend on their specific operations,
etc.
This patch completes SUNRPC PipeFS preparations and allows to create pipe
private data and PipeFS dentries independently.
Next step will be making SUNPRC PipeFS dentries allocated by SUNRPC PipeFS
network namespace aware routines.

Signed-off-by: default avatarStanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 9beae467
Loading
Loading
Loading
Loading
+12 −4
Original line number Original line Diff line number Diff line
@@ -46,7 +46,7 @@ MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andy Adamson <andros@citi.umich.edu>");
MODULE_AUTHOR("Andy Adamson <andros@citi.umich.edu>");
MODULE_DESCRIPTION("The NFSv4.1 pNFS Block layout driver");
MODULE_DESCRIPTION("The NFSv4.1 pNFS Block layout driver");


struct dentry *bl_device_pipe;
struct rpc_pipe *bl_device_pipe;
wait_queue_head_t bl_wq;
wait_queue_head_t bl_wq;


static void print_page(struct page *page)
static void print_page(struct page *page)
@@ -1051,16 +1051,23 @@ static int __init nfs4blocklayout_init(void)
	if (ret)
	if (ret)
		goto out_putrpc;
		goto out_putrpc;


	bl_device_pipe = rpc_mkpipe(path.dentry, "blocklayout", NULL,
	bl_device_pipe = rpc_mkpipe_data(&bl_upcall_ops, 0);
				    &bl_upcall_ops, 0);
	path_put(&path);
	path_put(&path);
	if (IS_ERR(bl_device_pipe)) {
	if (IS_ERR(bl_device_pipe)) {
		ret = PTR_ERR(bl_device_pipe);
		ret = PTR_ERR(bl_device_pipe);
		goto out_putrpc;
		goto out_putrpc;
	}
	}
	bl_device_pipe->dentry = rpc_mkpipe_dentry(path.dentry, "blocklayout",
						   NULL, bl_device_pipe);
	if (IS_ERR(bl_device_pipe->dentry)) {
		ret = PTR_ERR(bl_device_pipe->dentry);
		goto out_destroy_pipe;
	}
out:
out:
	return ret;
	return ret;


out_destroy_pipe:
	rpc_destroy_pipe_data(bl_device_pipe);
out_putrpc:
out_putrpc:
	rpc_put_mount();
	rpc_put_mount();
out_remove:
out_remove:
@@ -1074,7 +1081,8 @@ static void __exit nfs4blocklayout_exit(void)
	       __func__);
	       __func__);


	pnfs_unregister_layoutdriver(&blocklayout_type);
	pnfs_unregister_layoutdriver(&blocklayout_type);
	rpc_unlink(bl_device_pipe);
	rpc_unlink(bl_device_pipe->dentry);
	rpc_destroy_pipe_data(bl_device_pipe);
	rpc_put_mount();
	rpc_put_mount();
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -161,7 +161,7 @@ struct bl_msg_hdr {
	u16 totallen; /* length of entire message, including hdr itself */
	u16 totallen; /* length of entire message, including hdr itself */
};
};


extern struct dentry *bl_device_pipe;
extern struct rpc_pipe *bl_device_pipe;
extern wait_queue_head_t bl_wq;
extern wait_queue_head_t bl_wq;


#define BL_DEVICE_UMOUNT               0x0 /* Umount--delete devices */
#define BL_DEVICE_UMOUNT               0x0 /* Umount--delete devices */
+1 −1
Original line number Original line Diff line number Diff line
@@ -146,7 +146,7 @@ nfs4_blk_decode_device(struct nfs_server *server,


	dprintk("%s CALLING USERSPACE DAEMON\n", __func__);
	dprintk("%s CALLING USERSPACE DAEMON\n", __func__);
	add_wait_queue(&bl_wq, &wq);
	add_wait_queue(&bl_wq, &wq);
	rc = rpc_queue_upcall(RPC_I(bl_device_pipe->d_inode)->pipe, &msg);
	rc = rpc_queue_upcall(bl_device_pipe, &msg);
	if (rc < 0) {
	if (rc < 0) {
		remove_wait_queue(&bl_wq, &wq);
		remove_wait_queue(&bl_wq, &wq);
		rv = ERR_PTR(rc);
		rv = ERR_PTR(rc);
+1 −1
Original line number Original line Diff line number Diff line
@@ -66,7 +66,7 @@ static void dev_remove(dev_t dev)
	msg.len = sizeof(bl_msg) + bl_msg.totallen;
	msg.len = sizeof(bl_msg) + bl_msg.totallen;


	add_wait_queue(&bl_wq, &wq);
	add_wait_queue(&bl_wq, &wq);
	if (rpc_queue_upcall(RPC_I(bl_device_pipe->d_inode)->pipe, &msg) < 0) {
	if (rpc_queue_upcall(bl_device_pipe, &msg) < 0) {
		remove_wait_queue(&bl_wq, &wq);
		remove_wait_queue(&bl_wq, &wq);
		goto out;
		goto out;
	}
	}
+20 −8
Original line number Original line Diff line number Diff line
@@ -410,7 +410,7 @@ struct idmap_hashtable {
};
};


struct idmap {
struct idmap {
	struct dentry		*idmap_dentry;
	struct rpc_pipe		*idmap_pipe;
	wait_queue_head_t	idmap_wq;
	wait_queue_head_t	idmap_wq;
	struct idmap_msg	idmap_im;
	struct idmap_msg	idmap_im;
	struct mutex		idmap_lock;	/* Serializes upcalls */
	struct mutex		idmap_lock;	/* Serializes upcalls */
@@ -435,6 +435,7 @@ int
nfs_idmap_new(struct nfs_client *clp)
nfs_idmap_new(struct nfs_client *clp)
{
{
	struct idmap *idmap;
	struct idmap *idmap;
	struct rpc_pipe *pipe;
	int error;
	int error;


	BUG_ON(clp->cl_idmap != NULL);
	BUG_ON(clp->cl_idmap != NULL);
@@ -443,14 +444,23 @@ nfs_idmap_new(struct nfs_client *clp)
	if (idmap == NULL)
	if (idmap == NULL)
		return -ENOMEM;
		return -ENOMEM;


	idmap->idmap_dentry = rpc_mkpipe(clp->cl_rpcclient->cl_path.dentry,
	pipe = rpc_mkpipe_data(&idmap_upcall_ops, 0);
			"idmap", idmap, &idmap_upcall_ops, 0);
	if (IS_ERR(pipe)) {
	if (IS_ERR(idmap->idmap_dentry)) {
		error = PTR_ERR(pipe);
		error = PTR_ERR(idmap->idmap_dentry);
		kfree(idmap);
		kfree(idmap);
		return error;
		return error;
	}
	}


	if (clp->cl_rpcclient->cl_path.dentry)
		pipe->dentry = rpc_mkpipe_dentry(clp->cl_rpcclient->cl_path.dentry,
				"idmap", idmap, pipe);
	if (IS_ERR(pipe->dentry)) {
		error = PTR_ERR(pipe->dentry);
		rpc_destroy_pipe_data(pipe);
		kfree(idmap);
		return error;
	}
	idmap->idmap_pipe = pipe;
	mutex_init(&idmap->idmap_lock);
	mutex_init(&idmap->idmap_lock);
	mutex_init(&idmap->idmap_im_lock);
	mutex_init(&idmap->idmap_im_lock);
	init_waitqueue_head(&idmap->idmap_wq);
	init_waitqueue_head(&idmap->idmap_wq);
@@ -468,7 +478,9 @@ nfs_idmap_delete(struct nfs_client *clp)


	if (!idmap)
	if (!idmap)
		return;
		return;
	rpc_unlink(idmap->idmap_dentry);
	if (idmap->idmap_pipe->dentry)
		rpc_unlink(idmap->idmap_pipe->dentry);
	rpc_destroy_pipe_data(idmap->idmap_pipe);
	clp->cl_idmap = NULL;
	clp->cl_idmap = NULL;
	kfree(idmap);
	kfree(idmap);
}
}
@@ -589,7 +601,7 @@ nfs_idmap_id(struct idmap *idmap, struct idmap_hashtable *h,
	msg.len = sizeof(*im);
	msg.len = sizeof(*im);


	add_wait_queue(&idmap->idmap_wq, &wq);
	add_wait_queue(&idmap->idmap_wq, &wq);
	if (rpc_queue_upcall(RPC_I(idmap->idmap_dentry->d_inode)->pipe, &msg) < 0) {
	if (rpc_queue_upcall(idmap->idmap_pipe, &msg) < 0) {
		remove_wait_queue(&idmap->idmap_wq, &wq);
		remove_wait_queue(&idmap->idmap_wq, &wq);
		goto out;
		goto out;
	}
	}
@@ -650,7 +662,7 @@ nfs_idmap_name(struct idmap *idmap, struct idmap_hashtable *h,


	add_wait_queue(&idmap->idmap_wq, &wq);
	add_wait_queue(&idmap->idmap_wq, &wq);


	if (rpc_queue_upcall(RPC_I(idmap->idmap_dentry->d_inode)->pipe, &msg) < 0) {
	if (rpc_queue_upcall(idmap->idmap_pipe, &msg) < 0) {
		remove_wait_queue(&idmap->idmap_wq, &wq);
		remove_wait_queue(&idmap->idmap_wq, &wq);
		goto out;
		goto out;
	}
	}
Loading