diff options
Diffstat (limited to 'fs/9p/vfs_inode.c')
-rw-r--r-- | fs/9p/vfs_inode.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 411c70a88b3..fdc086d0744 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -219,6 +219,7 @@ struct inode *v9fs_alloc_inode(struct super_block *sb) | |||
219 | v9inode->fscache_key = NULL; | 219 | v9inode->fscache_key = NULL; |
220 | spin_lock_init(&v9inode->fscache_lock); | 220 | spin_lock_init(&v9inode->fscache_lock); |
221 | #endif | 221 | #endif |
222 | v9inode->writeback_fid = NULL; | ||
222 | return &v9inode->vfs_inode; | 223 | return &v9inode->vfs_inode; |
223 | } | 224 | } |
224 | 225 | ||
@@ -414,6 +415,8 @@ error: | |||
414 | */ | 415 | */ |
415 | void v9fs_evict_inode(struct inode *inode) | 416 | void v9fs_evict_inode(struct inode *inode) |
416 | { | 417 | { |
418 | struct v9fs_inode *v9inode = V9FS_I(inode); | ||
419 | |||
417 | truncate_inode_pages(inode->i_mapping, 0); | 420 | truncate_inode_pages(inode->i_mapping, 0); |
418 | end_writeback(inode); | 421 | end_writeback(inode); |
419 | filemap_fdatawrite(inode->i_mapping); | 422 | filemap_fdatawrite(inode->i_mapping); |
@@ -421,10 +424,10 @@ void v9fs_evict_inode(struct inode *inode) | |||
421 | #ifdef CONFIG_9P_FSCACHE | 424 | #ifdef CONFIG_9P_FSCACHE |
422 | v9fs_cache_inode_put_cookie(inode); | 425 | v9fs_cache_inode_put_cookie(inode); |
423 | #endif | 426 | #endif |
424 | /* clunk the fid stashed in inode->i_private */ | 427 | /* clunk the fid stashed in writeback_fid */ |
425 | if (inode->i_private) { | 428 | if (v9inode->writeback_fid) { |
426 | p9_client_clunk((struct p9_fid *)inode->i_private); | 429 | p9_client_clunk(v9inode->writeback_fid); |
427 | inode->i_private = NULL; | 430 | v9inode->writeback_fid = NULL; |
428 | } | 431 | } |
429 | } | 432 | } |
430 | 433 | ||
@@ -607,9 +610,10 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
607 | int err; | 610 | int err; |
608 | u32 perm; | 611 | u32 perm; |
609 | int flags; | 612 | int flags; |
613 | struct file *filp; | ||
614 | struct v9fs_inode *v9inode; | ||
610 | struct v9fs_session_info *v9ses; | 615 | struct v9fs_session_info *v9ses; |
611 | struct p9_fid *fid, *inode_fid; | 616 | struct p9_fid *fid, *inode_fid; |
612 | struct file *filp; | ||
613 | 617 | ||
614 | err = 0; | 618 | err = 0; |
615 | fid = NULL; | 619 | fid = NULL; |
@@ -631,9 +635,10 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
631 | 635 | ||
632 | /* if we are opening a file, assign the open fid to the file */ | 636 | /* if we are opening a file, assign the open fid to the file */ |
633 | if (nd && nd->flags & LOOKUP_OPEN) { | 637 | if (nd && nd->flags & LOOKUP_OPEN) { |
634 | if (v9ses->cache && !dentry->d_inode->i_private) { | 638 | v9inode = V9FS_I(dentry->d_inode); |
639 | if (v9ses->cache && !v9inode->writeback_fid) { | ||
635 | /* | 640 | /* |
636 | * clone a fid and add it to inode->i_private | 641 | * clone a fid and add it to writeback_fid |
637 | * we do it during open time instead of | 642 | * we do it during open time instead of |
638 | * page dirty time via write_begin/page_mkwrite | 643 | * page dirty time via write_begin/page_mkwrite |
639 | * because we want write after unlink usecase | 644 | * because we want write after unlink usecase |
@@ -644,7 +649,7 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
644 | err = PTR_ERR(inode_fid); | 649 | err = PTR_ERR(inode_fid); |
645 | goto error; | 650 | goto error; |
646 | } | 651 | } |
647 | dentry->d_inode->i_private = (void *) inode_fid; | 652 | v9inode->writeback_fid = (void *) inode_fid; |
648 | } | 653 | } |
649 | filp = lookup_instantiate_filp(nd, dentry, generic_file_open); | 654 | filp = lookup_instantiate_filp(nd, dentry, generic_file_open); |
650 | if (IS_ERR(filp)) { | 655 | if (IS_ERR(filp)) { |