diff options
author | M. Mohan Kumar <mohan@in.ibm.com> | 2011-01-07 20:58:46 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2011-01-11 10:58:08 -0500 |
commit | 31b6ceac497954c160c61f07e76b891b1cf53c90 (patch) | |
tree | 4874203ee50416646a95afc8b5ed868d9f30730f /fs | |
parent | 219fd58be62d01e30224c7af919dea77b7e392a8 (diff) |
fs/9p: TREADLINK bugfix
Remove v9fs_vfs_readlink_dotl function and use generic_readlink. Update
v9fs_vfs_follow_link_dotl function to accommodate this change
Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
Reported-by: Dr. David Alan Gilbert <linux@treblig.org>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/vfs_inode_dotl.c | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index b6f3977545f7..b7f8dcbabdb2 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c | |||
@@ -755,30 +755,6 @@ error: | |||
755 | return err; | 755 | return err; |
756 | } | 756 | } |
757 | 757 | ||
758 | static int | ||
759 | v9fs_vfs_readlink_dotl(struct dentry *dentry, char *buffer, int buflen) | ||
760 | { | ||
761 | int retval; | ||
762 | struct p9_fid *fid; | ||
763 | char *target = NULL; | ||
764 | |||
765 | P9_DPRINTK(P9_DEBUG_VFS, " %s\n", dentry->d_name.name); | ||
766 | retval = -EPERM; | ||
767 | fid = v9fs_fid_lookup(dentry); | ||
768 | if (IS_ERR(fid)) | ||
769 | return PTR_ERR(fid); | ||
770 | |||
771 | retval = p9_client_readlink(fid, &target); | ||
772 | if (retval < 0) | ||
773 | return retval; | ||
774 | |||
775 | strncpy(buffer, target, buflen); | ||
776 | P9_DPRINTK(P9_DEBUG_VFS, "%s -> %s\n", dentry->d_name.name, buffer); | ||
777 | |||
778 | retval = strnlen(buffer, buflen); | ||
779 | return retval; | ||
780 | } | ||
781 | |||
782 | /** | 758 | /** |
783 | * v9fs_vfs_follow_link_dotl - follow a symlink path | 759 | * v9fs_vfs_follow_link_dotl - follow a symlink path |
784 | * @dentry: dentry for symlink | 760 | * @dentry: dentry for symlink |
@@ -789,23 +765,33 @@ v9fs_vfs_readlink_dotl(struct dentry *dentry, char *buffer, int buflen) | |||
789 | static void * | 765 | static void * |
790 | v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd) | 766 | v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd) |
791 | { | 767 | { |
792 | int len = 0; | 768 | int retval; |
769 | struct p9_fid *fid; | ||
793 | char *link = __getname(); | 770 | char *link = __getname(); |
771 | char *target; | ||
794 | 772 | ||
795 | P9_DPRINTK(P9_DEBUG_VFS, "%s n", dentry->d_name.name); | 773 | P9_DPRINTK(P9_DEBUG_VFS, "%s\n", dentry->d_name.name); |
796 | 774 | ||
797 | if (!link) | 775 | if (!link) { |
798 | link = ERR_PTR(-ENOMEM); | 776 | link = ERR_PTR(-ENOMEM); |
799 | else { | 777 | goto ndset; |
800 | len = v9fs_vfs_readlink_dotl(dentry, link, PATH_MAX); | ||
801 | if (len < 0) { | ||
802 | __putname(link); | ||
803 | link = ERR_PTR(len); | ||
804 | } else | ||
805 | link[min(len, PATH_MAX-1)] = 0; | ||
806 | } | 778 | } |
779 | fid = v9fs_fid_lookup(dentry); | ||
780 | if (IS_ERR(fid)) { | ||
781 | __putname(link); | ||
782 | link = ERR_PTR(PTR_ERR(fid)); | ||
783 | goto ndset; | ||
784 | } | ||
785 | retval = p9_client_readlink(fid, &target); | ||
786 | if (!retval) { | ||
787 | strcpy(link, target); | ||
788 | kfree(target); | ||
789 | goto ndset; | ||
790 | } | ||
791 | __putname(link); | ||
792 | link = ERR_PTR(retval); | ||
793 | ndset: | ||
807 | nd_set_link(nd, link); | 794 | nd_set_link(nd, link); |
808 | |||
809 | return NULL; | 795 | return NULL; |
810 | } | 796 | } |
811 | 797 | ||
@@ -839,7 +825,7 @@ const struct inode_operations v9fs_file_inode_operations_dotl = { | |||
839 | }; | 825 | }; |
840 | 826 | ||
841 | const struct inode_operations v9fs_symlink_inode_operations_dotl = { | 827 | const struct inode_operations v9fs_symlink_inode_operations_dotl = { |
842 | .readlink = v9fs_vfs_readlink_dotl, | 828 | .readlink = generic_readlink, |
843 | .follow_link = v9fs_vfs_follow_link_dotl, | 829 | .follow_link = v9fs_vfs_follow_link_dotl, |
844 | .put_link = v9fs_vfs_put_link, | 830 | .put_link = v9fs_vfs_put_link, |
845 | .getattr = v9fs_vfs_getattr_dotl, | 831 | .getattr = v9fs_vfs_getattr_dotl, |