diff options
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r-- | fs/fuse/dir.c | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index f738599fd8cd..042af7346ec1 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -10,9 +10,9 @@ | |||
10 | 10 | ||
11 | #include <linux/pagemap.h> | 11 | #include <linux/pagemap.h> |
12 | #include <linux/file.h> | 12 | #include <linux/file.h> |
13 | #include <linux/gfp.h> | ||
14 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
15 | #include <linux/namei.h> | 14 | #include <linux/namei.h> |
15 | #include <linux/slab.h> | ||
16 | 16 | ||
17 | #if BITS_PER_LONG >= 64 | 17 | #if BITS_PER_LONG >= 64 |
18 | static inline void fuse_dentry_settime(struct dentry *entry, u64 time) | 18 | static inline void fuse_dentry_settime(struct dentry *entry, u64 time) |
@@ -169,7 +169,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) | |||
169 | struct fuse_entry_out outarg; | 169 | struct fuse_entry_out outarg; |
170 | struct fuse_conn *fc; | 170 | struct fuse_conn *fc; |
171 | struct fuse_req *req; | 171 | struct fuse_req *req; |
172 | struct fuse_req *forget_req; | 172 | struct fuse_forget_link *forget; |
173 | struct dentry *parent; | 173 | struct dentry *parent; |
174 | u64 attr_version; | 174 | u64 attr_version; |
175 | 175 | ||
@@ -182,8 +182,8 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) | |||
182 | if (IS_ERR(req)) | 182 | if (IS_ERR(req)) |
183 | return 0; | 183 | return 0; |
184 | 184 | ||
185 | forget_req = fuse_get_req(fc); | 185 | forget = fuse_alloc_forget(); |
186 | if (IS_ERR(forget_req)) { | 186 | if (!forget) { |
187 | fuse_put_request(fc, req); | 187 | fuse_put_request(fc, req); |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
@@ -203,15 +203,14 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) | |||
203 | if (!err) { | 203 | if (!err) { |
204 | struct fuse_inode *fi = get_fuse_inode(inode); | 204 | struct fuse_inode *fi = get_fuse_inode(inode); |
205 | if (outarg.nodeid != get_node_id(inode)) { | 205 | if (outarg.nodeid != get_node_id(inode)) { |
206 | fuse_send_forget(fc, forget_req, | 206 | fuse_queue_forget(fc, forget, outarg.nodeid, 1); |
207 | outarg.nodeid, 1); | ||
208 | return 0; | 207 | return 0; |
209 | } | 208 | } |
210 | spin_lock(&fc->lock); | 209 | spin_lock(&fc->lock); |
211 | fi->nlookup++; | 210 | fi->nlookup++; |
212 | spin_unlock(&fc->lock); | 211 | spin_unlock(&fc->lock); |
213 | } | 212 | } |
214 | fuse_put_request(fc, forget_req); | 213 | kfree(forget); |
215 | if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) | 214 | if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) |
216 | return 0; | 215 | return 0; |
217 | 216 | ||
@@ -263,7 +262,7 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name, | |||
263 | { | 262 | { |
264 | struct fuse_conn *fc = get_fuse_conn_super(sb); | 263 | struct fuse_conn *fc = get_fuse_conn_super(sb); |
265 | struct fuse_req *req; | 264 | struct fuse_req *req; |
266 | struct fuse_req *forget_req; | 265 | struct fuse_forget_link *forget; |
267 | u64 attr_version; | 266 | u64 attr_version; |
268 | int err; | 267 | int err; |
269 | 268 | ||
@@ -277,9 +276,9 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name, | |||
277 | if (IS_ERR(req)) | 276 | if (IS_ERR(req)) |
278 | goto out; | 277 | goto out; |
279 | 278 | ||
280 | forget_req = fuse_get_req(fc); | 279 | forget = fuse_alloc_forget(); |
281 | err = PTR_ERR(forget_req); | 280 | err = -ENOMEM; |
282 | if (IS_ERR(forget_req)) { | 281 | if (!forget) { |
283 | fuse_put_request(fc, req); | 282 | fuse_put_request(fc, req); |
284 | goto out; | 283 | goto out; |
285 | } | 284 | } |
@@ -305,13 +304,13 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, struct qstr *name, | |||
305 | attr_version); | 304 | attr_version); |
306 | err = -ENOMEM; | 305 | err = -ENOMEM; |
307 | if (!*inode) { | 306 | if (!*inode) { |
308 | fuse_send_forget(fc, forget_req, outarg->nodeid, 1); | 307 | fuse_queue_forget(fc, forget, outarg->nodeid, 1); |
309 | goto out; | 308 | goto out; |
310 | } | 309 | } |
311 | err = 0; | 310 | err = 0; |
312 | 311 | ||
313 | out_put_forget: | 312 | out_put_forget: |
314 | fuse_put_request(fc, forget_req); | 313 | kfree(forget); |
315 | out: | 314 | out: |
316 | return err; | 315 | return err; |
317 | } | 316 | } |
@@ -378,7 +377,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, | |||
378 | struct inode *inode; | 377 | struct inode *inode; |
379 | struct fuse_conn *fc = get_fuse_conn(dir); | 378 | struct fuse_conn *fc = get_fuse_conn(dir); |
380 | struct fuse_req *req; | 379 | struct fuse_req *req; |
381 | struct fuse_req *forget_req; | 380 | struct fuse_forget_link *forget; |
382 | struct fuse_create_in inarg; | 381 | struct fuse_create_in inarg; |
383 | struct fuse_open_out outopen; | 382 | struct fuse_open_out outopen; |
384 | struct fuse_entry_out outentry; | 383 | struct fuse_entry_out outentry; |
@@ -392,9 +391,9 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, | |||
392 | if (flags & O_DIRECT) | 391 | if (flags & O_DIRECT) |
393 | return -EINVAL; | 392 | return -EINVAL; |
394 | 393 | ||
395 | forget_req = fuse_get_req(fc); | 394 | forget = fuse_alloc_forget(); |
396 | if (IS_ERR(forget_req)) | 395 | if (!forget) |
397 | return PTR_ERR(forget_req); | 396 | return -ENOMEM; |
398 | 397 | ||
399 | req = fuse_get_req(fc); | 398 | req = fuse_get_req(fc); |
400 | err = PTR_ERR(req); | 399 | err = PTR_ERR(req); |
@@ -452,10 +451,10 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, | |||
452 | if (!inode) { | 451 | if (!inode) { |
453 | flags &= ~(O_CREAT | O_EXCL | O_TRUNC); | 452 | flags &= ~(O_CREAT | O_EXCL | O_TRUNC); |
454 | fuse_sync_release(ff, flags); | 453 | fuse_sync_release(ff, flags); |
455 | fuse_send_forget(fc, forget_req, outentry.nodeid, 1); | 454 | fuse_queue_forget(fc, forget, outentry.nodeid, 1); |
456 | return -ENOMEM; | 455 | return -ENOMEM; |
457 | } | 456 | } |
458 | fuse_put_request(fc, forget_req); | 457 | kfree(forget); |
459 | d_instantiate(entry, inode); | 458 | d_instantiate(entry, inode); |
460 | fuse_change_entry_timeout(entry, &outentry); | 459 | fuse_change_entry_timeout(entry, &outentry); |
461 | fuse_invalidate_attr(dir); | 460 | fuse_invalidate_attr(dir); |
@@ -473,7 +472,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, | |||
473 | out_put_request: | 472 | out_put_request: |
474 | fuse_put_request(fc, req); | 473 | fuse_put_request(fc, req); |
475 | out_put_forget_req: | 474 | out_put_forget_req: |
476 | fuse_put_request(fc, forget_req); | 475 | kfree(forget); |
477 | return err; | 476 | return err; |
478 | } | 477 | } |
479 | 478 | ||
@@ -487,12 +486,12 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, | |||
487 | struct fuse_entry_out outarg; | 486 | struct fuse_entry_out outarg; |
488 | struct inode *inode; | 487 | struct inode *inode; |
489 | int err; | 488 | int err; |
490 | struct fuse_req *forget_req; | 489 | struct fuse_forget_link *forget; |
491 | 490 | ||
492 | forget_req = fuse_get_req(fc); | 491 | forget = fuse_alloc_forget(); |
493 | if (IS_ERR(forget_req)) { | 492 | if (!forget) { |
494 | fuse_put_request(fc, req); | 493 | fuse_put_request(fc, req); |
495 | return PTR_ERR(forget_req); | 494 | return -ENOMEM; |
496 | } | 495 | } |
497 | 496 | ||
498 | memset(&outarg, 0, sizeof(outarg)); | 497 | memset(&outarg, 0, sizeof(outarg)); |
@@ -519,10 +518,10 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, | |||
519 | inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, | 518 | inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, |
520 | &outarg.attr, entry_attr_timeout(&outarg), 0); | 519 | &outarg.attr, entry_attr_timeout(&outarg), 0); |
521 | if (!inode) { | 520 | if (!inode) { |
522 | fuse_send_forget(fc, forget_req, outarg.nodeid, 1); | 521 | fuse_queue_forget(fc, forget, outarg.nodeid, 1); |
523 | return -ENOMEM; | 522 | return -ENOMEM; |
524 | } | 523 | } |
525 | fuse_put_request(fc, forget_req); | 524 | kfree(forget); |
526 | 525 | ||
527 | if (S_ISDIR(inode->i_mode)) { | 526 | if (S_ISDIR(inode->i_mode)) { |
528 | struct dentry *alias; | 527 | struct dentry *alias; |
@@ -545,7 +544,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, | |||
545 | return 0; | 544 | return 0; |
546 | 545 | ||
547 | out_put_forget_req: | 546 | out_put_forget_req: |
548 | fuse_put_request(fc, forget_req); | 547 | kfree(forget); |
549 | return err; | 548 | return err; |
550 | } | 549 | } |
551 | 550 | ||