aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/9p/vfs_super.c')
-rw-r--r--fs/9p/vfs_super.c54
1 files changed, 32 insertions, 22 deletions
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index be74d020436e..f9311077de68 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -45,6 +45,7 @@
45#include "v9fs.h" 45#include "v9fs.h"
46#include "v9fs_vfs.h" 46#include "v9fs_vfs.h"
47#include "fid.h" 47#include "fid.h"
48#include "xattr.h"
48 49
49static const struct super_operations v9fs_super_ops, v9fs_super_ops_dotl; 50static const struct super_operations v9fs_super_ops, v9fs_super_ops_dotl;
50 51
@@ -77,9 +78,10 @@ v9fs_fill_super(struct super_block *sb, struct v9fs_session_info *v9ses,
77 sb->s_blocksize_bits = fls(v9ses->maxdata - 1); 78 sb->s_blocksize_bits = fls(v9ses->maxdata - 1);
78 sb->s_blocksize = 1 << sb->s_blocksize_bits; 79 sb->s_blocksize = 1 << sb->s_blocksize_bits;
79 sb->s_magic = V9FS_MAGIC; 80 sb->s_magic = V9FS_MAGIC;
80 if (v9fs_proto_dotl(v9ses)) 81 if (v9fs_proto_dotl(v9ses)) {
81 sb->s_op = &v9fs_super_ops_dotl; 82 sb->s_op = &v9fs_super_ops_dotl;
82 else 83 sb->s_xattr = v9fs_xattr_handlers;
84 } else
83 sb->s_op = &v9fs_super_ops; 85 sb->s_op = &v9fs_super_ops;
84 sb->s_bdi = &v9ses->bdi; 86 sb->s_bdi = &v9ses->bdi;
85 87
@@ -107,7 +109,6 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
107 struct inode *inode = NULL; 109 struct inode *inode = NULL;
108 struct dentry *root = NULL; 110 struct dentry *root = NULL;
109 struct v9fs_session_info *v9ses = NULL; 111 struct v9fs_session_info *v9ses = NULL;
110 struct p9_wstat *st = NULL;
111 int mode = S_IRWXUGO | S_ISVTX; 112 int mode = S_IRWXUGO | S_ISVTX;
112 struct p9_fid *fid; 113 struct p9_fid *fid;
113 int retval = 0; 114 int retval = 0;
@@ -124,16 +125,10 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
124 goto close_session; 125 goto close_session;
125 } 126 }
126 127
127 st = p9_client_stat(fid);
128 if (IS_ERR(st)) {
129 retval = PTR_ERR(st);
130 goto clunk_fid;
131 }
132
133 sb = sget(fs_type, NULL, v9fs_set_super, v9ses); 128 sb = sget(fs_type, NULL, v9fs_set_super, v9ses);
134 if (IS_ERR(sb)) { 129 if (IS_ERR(sb)) {
135 retval = PTR_ERR(sb); 130 retval = PTR_ERR(sb);
136 goto free_stat; 131 goto clunk_fid;
137 } 132 }
138 v9fs_fill_super(sb, v9ses, flags, data); 133 v9fs_fill_super(sb, v9ses, flags, data);
139 134
@@ -151,22 +146,38 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags,
151 } 146 }
152 147
153 sb->s_root = root; 148 sb->s_root = root;
154 root->d_inode->i_ino = v9fs_qid2ino(&st->qid);
155 149
156 v9fs_stat2inode(st, root->d_inode, sb); 150 if (v9fs_proto_dotl(v9ses)) {
151 struct p9_stat_dotl *st = NULL;
152 st = p9_client_getattr_dotl(fid, P9_STATS_BASIC);
153 if (IS_ERR(st)) {
154 retval = PTR_ERR(st);
155 goto clunk_fid;
156 }
157
158 v9fs_stat2inode_dotl(st, root->d_inode);
159 kfree(st);
160 } else {
161 struct p9_wstat *st = NULL;
162 st = p9_client_stat(fid);
163 if (IS_ERR(st)) {
164 retval = PTR_ERR(st);
165 goto clunk_fid;
166 }
167
168 root->d_inode->i_ino = v9fs_qid2ino(&st->qid);
169 v9fs_stat2inode(st, root->d_inode, sb);
170
171 p9stat_free(st);
172 kfree(st);
173 }
157 174
158 v9fs_fid_add(root, fid); 175 v9fs_fid_add(root, fid);
159 p9stat_free(st);
160 kfree(st);
161 176
162P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); 177P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
163 simple_set_mnt(mnt, sb); 178 simple_set_mnt(mnt, sb);
164 return 0; 179 return 0;
165 180
166free_stat:
167 p9stat_free(st);
168 kfree(st);
169
170clunk_fid: 181clunk_fid:
171 p9_client_clunk(fid); 182 p9_client_clunk(fid);
172 183
@@ -176,8 +187,6 @@ close_session:
176 return retval; 187 return retval;
177 188
178release_sb: 189release_sb:
179 p9stat_free(st);
180 kfree(st);
181 deactivate_locked_super(sb); 190 deactivate_locked_super(sb);
182 return retval; 191 return retval;
183} 192}
@@ -257,7 +266,7 @@ static const struct super_operations v9fs_super_ops = {
257 .destroy_inode = v9fs_destroy_inode, 266 .destroy_inode = v9fs_destroy_inode,
258#endif 267#endif
259 .statfs = simple_statfs, 268 .statfs = simple_statfs,
260 .clear_inode = v9fs_clear_inode, 269 .evict_inode = v9fs_evict_inode,
261 .show_options = generic_show_options, 270 .show_options = generic_show_options,
262 .umount_begin = v9fs_umount_begin, 271 .umount_begin = v9fs_umount_begin,
263}; 272};
@@ -268,7 +277,7 @@ static const struct super_operations v9fs_super_ops_dotl = {
268 .destroy_inode = v9fs_destroy_inode, 277 .destroy_inode = v9fs_destroy_inode,
269#endif 278#endif
270 .statfs = v9fs_statfs, 279 .statfs = v9fs_statfs,
271 .clear_inode = v9fs_clear_inode, 280 .evict_inode = v9fs_evict_inode,
272 .show_options = generic_show_options, 281 .show_options = generic_show_options,
273 .umount_begin = v9fs_umount_begin, 282 .umount_begin = v9fs_umount_begin,
274}; 283};
@@ -278,4 +287,5 @@ struct file_system_type v9fs_fs_type = {
278 .get_sb = v9fs_get_sb, 287 .get_sb = v9fs_get_sb,
279 .kill_sb = v9fs_kill_super, 288 .kill_sb = v9fs_kill_super,
280 .owner = THIS_MODULE, 289 .owner = THIS_MODULE,
290 .fs_flags = FS_RENAME_DOES_D_MOVE,
281}; 291};