diff options
Diffstat (limited to 'fs/9p/vfs_inode.c')
-rw-r--r-- | fs/9p/vfs_inode.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 3d8a18ee78e6..3bbf705634b2 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -454,6 +454,11 @@ static int v9fs_test_inode(struct inode *inode, void *data) | |||
454 | return 1; | 454 | return 1; |
455 | } | 455 | } |
456 | 456 | ||
457 | static int v9fs_test_new_inode(struct inode *inode, void *data) | ||
458 | { | ||
459 | return 0; | ||
460 | } | ||
461 | |||
457 | static int v9fs_set_inode(struct inode *inode, void *data) | 462 | static int v9fs_set_inode(struct inode *inode, void *data) |
458 | { | 463 | { |
459 | struct v9fs_inode *v9inode = V9FS_I(inode); | 464 | struct v9fs_inode *v9inode = V9FS_I(inode); |
@@ -465,15 +470,22 @@ static int v9fs_set_inode(struct inode *inode, void *data) | |||
465 | 470 | ||
466 | static struct inode *v9fs_qid_iget(struct super_block *sb, | 471 | static struct inode *v9fs_qid_iget(struct super_block *sb, |
467 | struct p9_qid *qid, | 472 | struct p9_qid *qid, |
468 | struct p9_wstat *st) | 473 | struct p9_wstat *st, |
474 | int new) | ||
469 | { | 475 | { |
470 | int retval, umode; | 476 | int retval, umode; |
471 | unsigned long i_ino; | 477 | unsigned long i_ino; |
472 | struct inode *inode; | 478 | struct inode *inode; |
473 | struct v9fs_session_info *v9ses = sb->s_fs_info; | 479 | struct v9fs_session_info *v9ses = sb->s_fs_info; |
480 | int (*test)(struct inode *, void *); | ||
481 | |||
482 | if (new) | ||
483 | test = v9fs_test_new_inode; | ||
484 | else | ||
485 | test = v9fs_test_inode; | ||
474 | 486 | ||
475 | i_ino = v9fs_qid2ino(qid); | 487 | i_ino = v9fs_qid2ino(qid); |
476 | inode = iget5_locked(sb, i_ino, v9fs_test_inode, v9fs_set_inode, st); | 488 | inode = iget5_locked(sb, i_ino, test, v9fs_set_inode, st); |
477 | if (!inode) | 489 | if (!inode) |
478 | return ERR_PTR(-ENOMEM); | 490 | return ERR_PTR(-ENOMEM); |
479 | if (!(inode->i_state & I_NEW)) | 491 | if (!(inode->i_state & I_NEW)) |
@@ -504,7 +516,7 @@ error: | |||
504 | 516 | ||
505 | struct inode * | 517 | struct inode * |
506 | v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, | 518 | v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, |
507 | struct super_block *sb) | 519 | struct super_block *sb, int new) |
508 | { | 520 | { |
509 | struct p9_wstat *st; | 521 | struct p9_wstat *st; |
510 | struct inode *inode = NULL; | 522 | struct inode *inode = NULL; |
@@ -513,7 +525,7 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, | |||
513 | if (IS_ERR(st)) | 525 | if (IS_ERR(st)) |
514 | return ERR_CAST(st); | 526 | return ERR_CAST(st); |
515 | 527 | ||
516 | inode = v9fs_qid_iget(sb, &st->qid, st); | 528 | inode = v9fs_qid_iget(sb, &st->qid, st, new); |
517 | p9stat_free(st); | 529 | p9stat_free(st); |
518 | kfree(st); | 530 | kfree(st); |
519 | return inode; | 531 | return inode; |
@@ -615,7 +627,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
615 | } | 627 | } |
616 | 628 | ||
617 | /* instantiate inode and assign the unopened fid to the dentry */ | 629 | /* instantiate inode and assign the unopened fid to the dentry */ |
618 | inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb); | 630 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
619 | if (IS_ERR(inode)) { | 631 | if (IS_ERR(inode)) { |
620 | err = PTR_ERR(inode); | 632 | err = PTR_ERR(inode); |
621 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); | 633 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); |