diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-03-11 10:20:23 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-03-11 10:57:34 -0400 |
commit | cb9c1c4a880bc734c2848f8647be2cfa336ee346 (patch) | |
tree | 84006417e491ba57da87a88212c5c9dda3fd4e96 /fs/nfs | |
parent | d6d6dc7cdfda7c8f49a89a7b7261846f319da6d1 (diff) |
NFS: replace global bl_mount_reply with per-net one
This global variable is used for blocklayout downcall and thus can be corrupted
if case of existence of multiple networks namespaces.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/blocklayout/blocklayout.h | 5 | ||||
-rw-r--r-- | fs/nfs/blocklayout/blocklayoutdev.c | 9 | ||||
-rw-r--r-- | fs/nfs/netns.h | 6 |
3 files changed, 11 insertions, 9 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.h b/fs/nfs/blocklayout/blocklayout.h index 0966b39bbcfb..58ac8614c4c4 100644 --- a/fs/nfs/blocklayout/blocklayout.h +++ b/fs/nfs/blocklayout/blocklayout.h | |||
@@ -153,11 +153,6 @@ BLK_LSEG2EXT(struct pnfs_layout_segment *lseg) | |||
153 | return BLK_LO2EXT(lseg->pls_layout); | 153 | return BLK_LO2EXT(lseg->pls_layout); |
154 | } | 154 | } |
155 | 155 | ||
156 | struct bl_dev_msg { | ||
157 | int32_t status; | ||
158 | uint32_t major, minor; | ||
159 | }; | ||
160 | |||
161 | struct bl_msg_hdr { | 156 | struct bl_msg_hdr { |
162 | u8 type; | 157 | u8 type; |
163 | u16 totallen; /* length of entire message, including hdr itself */ | 158 | u16 totallen; /* length of entire message, including hdr itself */ |
diff --git a/fs/nfs/blocklayout/blocklayoutdev.c b/fs/nfs/blocklayout/blocklayoutdev.c index b48f782a94ad..1d58642b1530 100644 --- a/fs/nfs/blocklayout/blocklayoutdev.c +++ b/fs/nfs/blocklayout/blocklayoutdev.c | |||
@@ -79,15 +79,16 @@ int nfs4_blkdev_put(struct block_device *bdev) | |||
79 | return blkdev_put(bdev, FMODE_READ); | 79 | return blkdev_put(bdev, FMODE_READ); |
80 | } | 80 | } |
81 | 81 | ||
82 | static struct bl_dev_msg bl_mount_reply; | ||
83 | |||
84 | ssize_t bl_pipe_downcall(struct file *filp, const char __user *src, | 82 | ssize_t bl_pipe_downcall(struct file *filp, const char __user *src, |
85 | size_t mlen) | 83 | size_t mlen) |
86 | { | 84 | { |
85 | struct nfs_net *nn = net_generic(filp->f_dentry->d_sb->s_fs_info, | ||
86 | nfs_net_id); | ||
87 | |||
87 | if (mlen != sizeof (struct bl_dev_msg)) | 88 | if (mlen != sizeof (struct bl_dev_msg)) |
88 | return -EINVAL; | 89 | return -EINVAL; |
89 | 90 | ||
90 | if (copy_from_user(&bl_mount_reply, src, mlen) != 0) | 91 | if (copy_from_user(&nn->bl_mount_reply, src, mlen) != 0) |
91 | return -EFAULT; | 92 | return -EFAULT; |
92 | 93 | ||
93 | wake_up(&bl_wq); | 94 | wake_up(&bl_wq); |
@@ -118,10 +119,10 @@ nfs4_blk_decode_device(struct nfs_server *server, | |||
118 | }; | 119 | }; |
119 | uint8_t *dataptr; | 120 | uint8_t *dataptr; |
120 | DECLARE_WAITQUEUE(wq, current); | 121 | DECLARE_WAITQUEUE(wq, current); |
121 | struct bl_dev_msg *reply = &bl_mount_reply; | ||
122 | int offset, len, i, rc; | 122 | int offset, len, i, rc; |
123 | struct net *net = server->nfs_client->net; | 123 | struct net *net = server->nfs_client->net; |
124 | struct nfs_net *nn = net_generic(net, nfs_net_id); | 124 | struct nfs_net *nn = net_generic(net, nfs_net_id); |
125 | struct bl_dev_msg *reply = &nn->bl_mount_reply; | ||
125 | 126 | ||
126 | dprintk("%s CREATING PIPEFS MESSAGE\n", __func__); | 127 | dprintk("%s CREATING PIPEFS MESSAGE\n", __func__); |
127 | dprintk("%s: deviceid: %s, mincount: %d\n", __func__, dev->dev_id.data, | 128 | dprintk("%s: deviceid: %s, mincount: %d\n", __func__, dev->dev_id.data, |
diff --git a/fs/nfs/netns.h b/fs/nfs/netns.h index 7baad89ae60e..73425f555cde 100644 --- a/fs/nfs/netns.h +++ b/fs/nfs/netns.h | |||
@@ -4,9 +4,15 @@ | |||
4 | #include <net/net_namespace.h> | 4 | #include <net/net_namespace.h> |
5 | #include <net/netns/generic.h> | 5 | #include <net/netns/generic.h> |
6 | 6 | ||
7 | struct bl_dev_msg { | ||
8 | int32_t status; | ||
9 | uint32_t major, minor; | ||
10 | }; | ||
11 | |||
7 | struct nfs_net { | 12 | struct nfs_net { |
8 | struct cache_detail *nfs_dns_resolve; | 13 | struct cache_detail *nfs_dns_resolve; |
9 | struct rpc_pipe *bl_device_pipe; | 14 | struct rpc_pipe *bl_device_pipe; |
15 | struct bl_dev_msg bl_mount_reply; | ||
10 | struct list_head nfs_client_list; | 16 | struct list_head nfs_client_list; |
11 | struct list_head nfs_volume_list; | 17 | struct list_head nfs_volume_list; |
12 | #ifdef CONFIG_NFS_V4 | 18 | #ifdef CONFIG_NFS_V4 |