diff options
Diffstat (limited to 'fs/9p')
-rw-r--r-- | fs/9p/v9fs.c | 33 | ||||
-rw-r--r-- | fs/9p/v9fs_vfs.h | 1 | ||||
-rw-r--r-- | fs/9p/vfs_file.c | 19 | ||||
-rw-r--r-- | fs/9p/vfs_inode.c | 2 | ||||
-rw-r--r-- | fs/9p/vfs_super.c | 3 |
5 files changed, 44 insertions, 14 deletions
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index cf62b05e296..7d6c2139891 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -84,7 +84,7 @@ static const match_table_t tokens = { | |||
84 | 84 | ||
85 | static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | 85 | static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) |
86 | { | 86 | { |
87 | char *options; | 87 | char *options, *tmp_options; |
88 | substring_t args[MAX_OPT_ARGS]; | 88 | substring_t args[MAX_OPT_ARGS]; |
89 | char *p; | 89 | char *p; |
90 | int option = 0; | 90 | int option = 0; |
@@ -102,9 +102,12 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | |||
102 | if (!opts) | 102 | if (!opts) |
103 | return 0; | 103 | return 0; |
104 | 104 | ||
105 | options = kstrdup(opts, GFP_KERNEL); | 105 | tmp_options = kstrdup(opts, GFP_KERNEL); |
106 | if (!options) | 106 | if (!tmp_options) { |
107 | ret = -ENOMEM; | ||
107 | goto fail_option_alloc; | 108 | goto fail_option_alloc; |
109 | } | ||
110 | options = tmp_options; | ||
108 | 111 | ||
109 | while ((p = strsep(&options, ",")) != NULL) { | 112 | while ((p = strsep(&options, ",")) != NULL) { |
110 | int token; | 113 | int token; |
@@ -159,8 +162,12 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | |||
159 | break; | 162 | break; |
160 | case Opt_cache: | 163 | case Opt_cache: |
161 | s = match_strdup(&args[0]); | 164 | s = match_strdup(&args[0]); |
162 | if (!s) | 165 | if (!s) { |
163 | goto fail_option_alloc; | 166 | ret = -ENOMEM; |
167 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
168 | "problem allocating copy of cache arg\n"); | ||
169 | goto free_and_return; | ||
170 | } | ||
164 | 171 | ||
165 | if (strcmp(s, "loose") == 0) | 172 | if (strcmp(s, "loose") == 0) |
166 | v9ses->cache = CACHE_LOOSE; | 173 | v9ses->cache = CACHE_LOOSE; |
@@ -173,8 +180,12 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | |||
173 | 180 | ||
174 | case Opt_access: | 181 | case Opt_access: |
175 | s = match_strdup(&args[0]); | 182 | s = match_strdup(&args[0]); |
176 | if (!s) | 183 | if (!s) { |
177 | goto fail_option_alloc; | 184 | ret = -ENOMEM; |
185 | P9_DPRINTK(P9_DEBUG_ERROR, | ||
186 | "problem allocating copy of access arg\n"); | ||
187 | goto free_and_return; | ||
188 | } | ||
178 | 189 | ||
179 | v9ses->flags &= ~V9FS_ACCESS_MASK; | 190 | v9ses->flags &= ~V9FS_ACCESS_MASK; |
180 | if (strcmp(s, "user") == 0) | 191 | if (strcmp(s, "user") == 0) |
@@ -194,13 +205,11 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts) | |||
194 | continue; | 205 | continue; |
195 | } | 206 | } |
196 | } | 207 | } |
197 | kfree(options); | ||
198 | return ret; | ||
199 | 208 | ||
209 | free_and_return: | ||
210 | kfree(tmp_options); | ||
200 | fail_option_alloc: | 211 | fail_option_alloc: |
201 | P9_DPRINTK(P9_DEBUG_ERROR, | 212 | return ret; |
202 | "failed to allocate copy of option argument\n"); | ||
203 | return -ENOMEM; | ||
204 | } | 213 | } |
205 | 214 | ||
206 | /** | 215 | /** |
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index 3a7560e3586..ed835836e0d 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h | |||
@@ -60,3 +60,4 @@ void v9fs_dentry_release(struct dentry *); | |||
60 | int v9fs_uflags2omode(int uflags, int extended); | 60 | int v9fs_uflags2omode(int uflags, int extended); |
61 | 61 | ||
62 | ssize_t v9fs_file_readn(struct file *, char *, char __user *, u32, u64); | 62 | ssize_t v9fs_file_readn(struct file *, char *, char __user *, u32, u64); |
63 | void v9fs_blank_wstat(struct p9_wstat *wstat); | ||
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 3902bf43a08..74a0461a9ac 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -257,6 +257,23 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
257 | return total; | 257 | return total; |
258 | } | 258 | } |
259 | 259 | ||
260 | static int v9fs_file_fsync(struct file *filp, struct dentry *dentry, | ||
261 | int datasync) | ||
262 | { | ||
263 | struct p9_fid *fid; | ||
264 | struct p9_wstat wstat; | ||
265 | int retval; | ||
266 | |||
267 | P9_DPRINTK(P9_DEBUG_VFS, "filp %p dentry %p datasync %x\n", filp, | ||
268 | dentry, datasync); | ||
269 | |||
270 | fid = filp->private_data; | ||
271 | v9fs_blank_wstat(&wstat); | ||
272 | |||
273 | retval = p9_client_wstat(fid, &wstat); | ||
274 | return retval; | ||
275 | } | ||
276 | |||
260 | static const struct file_operations v9fs_cached_file_operations = { | 277 | static const struct file_operations v9fs_cached_file_operations = { |
261 | .llseek = generic_file_llseek, | 278 | .llseek = generic_file_llseek, |
262 | .read = do_sync_read, | 279 | .read = do_sync_read, |
@@ -266,6 +283,7 @@ static const struct file_operations v9fs_cached_file_operations = { | |||
266 | .release = v9fs_dir_release, | 283 | .release = v9fs_dir_release, |
267 | .lock = v9fs_file_lock, | 284 | .lock = v9fs_file_lock, |
268 | .mmap = generic_file_readonly_mmap, | 285 | .mmap = generic_file_readonly_mmap, |
286 | .fsync = v9fs_file_fsync, | ||
269 | }; | 287 | }; |
270 | 288 | ||
271 | const struct file_operations v9fs_file_operations = { | 289 | const struct file_operations v9fs_file_operations = { |
@@ -276,4 +294,5 @@ const struct file_operations v9fs_file_operations = { | |||
276 | .release = v9fs_dir_release, | 294 | .release = v9fs_dir_release, |
277 | .lock = v9fs_file_lock, | 295 | .lock = v9fs_file_lock, |
278 | .mmap = generic_file_readonly_mmap, | 296 | .mmap = generic_file_readonly_mmap, |
297 | .fsync = v9fs_file_fsync, | ||
279 | }; | 298 | }; |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 9d03d1ebca6..a407fa3388c 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -176,7 +176,7 @@ int v9fs_uflags2omode(int uflags, int extended) | |||
176 | * | 176 | * |
177 | */ | 177 | */ |
178 | 178 | ||
179 | static void | 179 | void |
180 | v9fs_blank_wstat(struct p9_wstat *wstat) | 180 | v9fs_blank_wstat(struct p9_wstat *wstat) |
181 | { | 181 | { |
182 | wstat->type = ~0; | 182 | wstat->type = ~0; |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 14a86448572..69357c0d989 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -188,7 +188,8 @@ static void v9fs_kill_super(struct super_block *s) | |||
188 | 188 | ||
189 | P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); | 189 | P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); |
190 | 190 | ||
191 | v9fs_dentry_release(s->s_root); /* clunk root */ | 191 | if (s->s_root) |
192 | v9fs_dentry_release(s->s_root); /* clunk root */ | ||
192 | 193 | ||
193 | kill_anon_super(s); | 194 | kill_anon_super(s); |
194 | 195 | ||