aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2011-05-26 23:50:55 -0400
committerSteve French <sfrench@us.ibm.com>2011-05-26 23:50:55 -0400
commitf87d39d951329cd8f462bf9007d334122c0599d0 (patch)
treeba4c4d9dee6958c7d8ee87070a58d80389be2d2f /fs/cifs/inode.c
parent641a58d66d086327042e9d73c6606fd02c8f067c (diff)
[CIFS] Migrate from prefixpath logic
Now we point superblock to a server share root and set a root dentry appropriately. This let us share superblock between mounts like //server/sharename/foo/bar and //server/sharename/foo further. Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 5e278d37912b..53ea6250a51d 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -735,10 +735,10 @@ static const struct inode_operations cifs_ipc_inode_ops = {
735 .lookup = cifs_lookup, 735 .lookup = cifs_lookup,
736}; 736};
737 737
738char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb, 738char *cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
739 struct cifsTconInfo *tcon) 739 struct cifsTconInfo *tcon)
740{ 740{
741 int pplen = cifs_sb->prepathlen; 741 int pplen = vol->prepath ? strlen(vol->prepath) : 0;
742 int dfsplen; 742 int dfsplen;
743 char *full_path = NULL; 743 char *full_path = NULL;
744 744
@@ -772,7 +772,7 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb,
772 } 772 }
773 } 773 }
774 } 774 }
775 strncpy(full_path + dfsplen, cifs_sb->prepath, pplen); 775 strncpy(full_path + dfsplen, vol->prepath, pplen);
776 full_path[dfsplen + pplen] = 0; /* add trailing null */ 776 full_path[dfsplen + pplen] = 0; /* add trailing null */
777 return full_path; 777 return full_path;
778} 778}
@@ -884,19 +884,13 @@ struct inode *cifs_root_iget(struct super_block *sb)
884 struct cifs_sb_info *cifs_sb = CIFS_SB(sb); 884 struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
885 struct inode *inode = NULL; 885 struct inode *inode = NULL;
886 long rc; 886 long rc;
887 char *full_path;
888 struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); 887 struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb);
889 888
890 full_path = cifs_build_path_to_root(cifs_sb, tcon);
891 if (full_path == NULL)
892 return ERR_PTR(-ENOMEM);
893
894 xid = GetXid(); 889 xid = GetXid();
895 if (tcon->unix_ext) 890 if (tcon->unix_ext)
896 rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); 891 rc = cifs_get_inode_info_unix(&inode, "", sb, xid);
897 else 892 else
898 rc = cifs_get_inode_info(&inode, full_path, NULL, sb, 893 rc = cifs_get_inode_info(&inode, "", NULL, sb, xid, NULL);
899 xid, NULL);
900 894
901 if (!inode) { 895 if (!inode) {
902 inode = ERR_PTR(rc); 896 inode = ERR_PTR(rc);
@@ -922,7 +916,6 @@ struct inode *cifs_root_iget(struct super_block *sb)
922 } 916 }
923 917
924out: 918out:
925 kfree(full_path);
926 /* can not call macro FreeXid here since in a void func 919 /* can not call macro FreeXid here since in a void func
927 * TODO: This is no longer true 920 * TODO: This is no longer true
928 */ 921 */