diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2012-01-05 11:42:17 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2012-01-05 11:51:44 -0500 |
commit | b6054793069bf08fcf220fff5fb33735d5493594 (patch) | |
tree | 44e4e3bded86642f35d183be9166ac78c1629a11 /fs/9p/vfs_inode.c | |
parent | df345c674b6366952a21a67604c8f6d489bb7ea7 (diff) |
fs/9p: We should not allocate a new inode when creating hardlines.
Don't do new_inode_from fid in case of hardlink creation. This ensures
that link count for hardlink files get updated properly. Earlier link count
was not updated on removing a hardlink with cache mode enabled.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/vfs_inode.c')
-rw-r--r-- | fs/9p/vfs_inode.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index cf3dd6bc537e..c8fe480d0db0 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -680,26 +680,31 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir, | |||
680 | goto error; | 680 | goto error; |
681 | } | 681 | } |
682 | 682 | ||
683 | /* now walk from the parent so we can get unopened fid */ | 683 | if (!(perm & P9_DMLINK)) { |
684 | fid = p9_client_walk(dfid, 1, &name, 1); | 684 | /* now walk from the parent so we can get unopened fid */ |
685 | if (IS_ERR(fid)) { | 685 | fid = p9_client_walk(dfid, 1, &name, 1); |
686 | err = PTR_ERR(fid); | 686 | if (IS_ERR(fid)) { |
687 | p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err); | 687 | err = PTR_ERR(fid); |
688 | fid = NULL; | 688 | p9_debug(P9_DEBUG_VFS, |
689 | goto error; | 689 | "p9_client_walk failed %d\n", err); |
690 | } | 690 | fid = NULL; |
691 | 691 | goto error; | |
692 | /* instantiate inode and assign the unopened fid to the dentry */ | 692 | } |
693 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); | 693 | /* |
694 | if (IS_ERR(inode)) { | 694 | * instantiate inode and assign the unopened fid to the dentry |
695 | err = PTR_ERR(inode); | 695 | */ |
696 | p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err); | 696 | inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); |
697 | goto error; | 697 | if (IS_ERR(inode)) { |
698 | err = PTR_ERR(inode); | ||
699 | p9_debug(P9_DEBUG_VFS, | ||
700 | "inode creation failed %d\n", err); | ||
701 | goto error; | ||
702 | } | ||
703 | err = v9fs_fid_add(dentry, fid); | ||
704 | if (err < 0) | ||
705 | goto error; | ||
706 | d_instantiate(dentry, inode); | ||
698 | } | 707 | } |
699 | err = v9fs_fid_add(dentry, fid); | ||
700 | if (err < 0) | ||
701 | goto error; | ||
702 | d_instantiate(dentry, inode); | ||
703 | return ofid; | 708 | return ofid; |
704 | error: | 709 | error: |
705 | if (ofid) | 710 | if (ofid) |