diff options
Diffstat (limited to 'fs/nfs/blocklayout/blocklayout.c')
-rw-r--r-- | fs/nfs/blocklayout/blocklayout.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index 8dde3723482e..c83878441047 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c | |||
@@ -31,6 +31,8 @@ | |||
31 | */ | 31 | */ |
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/mount.h> | ||
35 | #include <linux/namei.h> | ||
34 | 36 | ||
35 | #include "blocklayout.h" | 37 | #include "blocklayout.h" |
36 | 38 | ||
@@ -40,6 +42,9 @@ MODULE_LICENSE("GPL"); | |||
40 | MODULE_AUTHOR("Andy Adamson <andros@citi.umich.edu>"); | 42 | MODULE_AUTHOR("Andy Adamson <andros@citi.umich.edu>"); |
41 | MODULE_DESCRIPTION("The NFSv4.1 pNFS Block layout driver"); | 43 | MODULE_DESCRIPTION("The NFSv4.1 pNFS Block layout driver"); |
42 | 44 | ||
45 | struct dentry *bl_device_pipe; | ||
46 | wait_queue_head_t bl_wq; | ||
47 | |||
43 | static enum pnfs_try_status | 48 | static enum pnfs_try_status |
44 | bl_read_pagelist(struct nfs_read_data *rdata) | 49 | bl_read_pagelist(struct nfs_read_data *rdata) |
45 | { | 50 | { |
@@ -176,13 +181,49 @@ static struct pnfs_layoutdriver_type blocklayout_type = { | |||
176 | .pg_write_ops = &bl_pg_write_ops, | 181 | .pg_write_ops = &bl_pg_write_ops, |
177 | }; | 182 | }; |
178 | 183 | ||
184 | static const struct rpc_pipe_ops bl_upcall_ops = { | ||
185 | .upcall = bl_pipe_upcall, | ||
186 | .downcall = bl_pipe_downcall, | ||
187 | .destroy_msg = bl_pipe_destroy_msg, | ||
188 | }; | ||
189 | |||
179 | static int __init nfs4blocklayout_init(void) | 190 | static int __init nfs4blocklayout_init(void) |
180 | { | 191 | { |
192 | struct vfsmount *mnt; | ||
193 | struct path path; | ||
181 | int ret; | 194 | int ret; |
182 | 195 | ||
183 | dprintk("%s: NFSv4 Block Layout Driver Registering...\n", __func__); | 196 | dprintk("%s: NFSv4 Block Layout Driver Registering...\n", __func__); |
184 | 197 | ||
185 | ret = pnfs_register_layoutdriver(&blocklayout_type); | 198 | ret = pnfs_register_layoutdriver(&blocklayout_type); |
199 | if (ret) | ||
200 | goto out; | ||
201 | |||
202 | init_waitqueue_head(&bl_wq); | ||
203 | |||
204 | mnt = rpc_get_mount(); | ||
205 | if (IS_ERR(mnt)) { | ||
206 | ret = PTR_ERR(mnt); | ||
207 | goto out_remove; | ||
208 | } | ||
209 | |||
210 | ret = vfs_path_lookup(mnt->mnt_root, | ||
211 | mnt, | ||
212 | NFS_PIPE_DIRNAME, 0, &path); | ||
213 | if (ret) | ||
214 | goto out_remove; | ||
215 | |||
216 | bl_device_pipe = rpc_mkpipe(path.dentry, "blocklayout", NULL, | ||
217 | &bl_upcall_ops, 0); | ||
218 | if (IS_ERR(bl_device_pipe)) { | ||
219 | ret = PTR_ERR(bl_device_pipe); | ||
220 | goto out_remove; | ||
221 | } | ||
222 | out: | ||
223 | return ret; | ||
224 | |||
225 | out_remove: | ||
226 | pnfs_unregister_layoutdriver(&blocklayout_type); | ||
186 | return ret; | 227 | return ret; |
187 | } | 228 | } |
188 | 229 | ||
@@ -192,6 +233,7 @@ static void __exit nfs4blocklayout_exit(void) | |||
192 | __func__); | 233 | __func__); |
193 | 234 | ||
194 | pnfs_unregister_layoutdriver(&blocklayout_type); | 235 | pnfs_unregister_layoutdriver(&blocklayout_type); |
236 | rpc_unlink(bl_device_pipe); | ||
195 | } | 237 | } |
196 | 238 | ||
197 | MODULE_ALIAS("nfs-layouttype4-3"); | 239 | MODULE_ALIAS("nfs-layouttype4-3"); |