diff options
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 65d0ba72e78f..8dbfa97cd18c 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1722,8 +1722,15 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon, | |||
1722 | originally at mount time */ | 1722 | originally at mount time */ |
1723 | if ((saved_cap & CIFS_UNIX_POSIX_ACL_CAP) == 0) | 1723 | if ((saved_cap & CIFS_UNIX_POSIX_ACL_CAP) == 0) |
1724 | cap &= ~CIFS_UNIX_POSIX_ACL_CAP; | 1724 | cap &= ~CIFS_UNIX_POSIX_ACL_CAP; |
1725 | if ((saved_cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) | 1725 | if ((saved_cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) { |
1726 | if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) | ||
1727 | cERROR(1, ("POSIXPATH support change")); | ||
1726 | cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP; | 1728 | cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP; |
1729 | } else if ((cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) { | ||
1730 | cERROR(1, ("possible reconnect error")); | ||
1731 | cERROR(1, | ||
1732 | ("server disabled POSIX path support")); | ||
1733 | } | ||
1727 | } | 1734 | } |
1728 | 1735 | ||
1729 | cap &= CIFS_UNIX_CAP_MASK; | 1736 | cap &= CIFS_UNIX_CAP_MASK; |
@@ -1753,9 +1760,8 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon, | |||
1753 | if (sb && (CIFS_SB(sb)->rsize > 127 * 1024)) { | 1760 | if (sb && (CIFS_SB(sb)->rsize > 127 * 1024)) { |
1754 | if ((cap & CIFS_UNIX_LARGE_READ_CAP) == 0) { | 1761 | if ((cap & CIFS_UNIX_LARGE_READ_CAP) == 0) { |
1755 | CIFS_SB(sb)->rsize = 127 * 1024; | 1762 | CIFS_SB(sb)->rsize = 127 * 1024; |
1756 | #ifdef CONFIG_CIFS_DEBUG2 | 1763 | cFYI(DBG2, |
1757 | cFYI(1, ("larger reads not supported by srv")); | 1764 | ("larger reads not supported by srv")); |
1758 | #endif | ||
1759 | } | 1765 | } |
1760 | } | 1766 | } |
1761 | 1767 | ||
@@ -1792,6 +1798,26 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon, | |||
1792 | } | 1798 | } |
1793 | } | 1799 | } |
1794 | 1800 | ||
1801 | static void | ||
1802 | convert_delimiter(char *path, char delim) | ||
1803 | { | ||
1804 | int i; | ||
1805 | char old_delim; | ||
1806 | |||
1807 | if (path == NULL) | ||
1808 | return; | ||
1809 | |||
1810 | if (delim == '/') | ||
1811 | old_delim = '\\'; | ||
1812 | else | ||
1813 | old_delim = '/'; | ||
1814 | |||
1815 | for (i = 0; path[i] != '\0'; i++) { | ||
1816 | if (path[i] == old_delim) | ||
1817 | path[i] = delim; | ||
1818 | } | ||
1819 | } | ||
1820 | |||
1795 | int | 1821 | int |
1796 | cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | 1822 | cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, |
1797 | char *mount_data, const char *devname) | 1823 | char *mount_data, const char *devname) |
@@ -2057,7 +2083,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2057 | cifs_sb->prepath = volume_info.prepath; | 2083 | cifs_sb->prepath = volume_info.prepath; |
2058 | if (cifs_sb->prepath) { | 2084 | if (cifs_sb->prepath) { |
2059 | cifs_sb->prepathlen = strlen(cifs_sb->prepath); | 2085 | cifs_sb->prepathlen = strlen(cifs_sb->prepath); |
2060 | cifs_sb->prepath[0] = CIFS_DIR_SEP(cifs_sb); | 2086 | /* we can not convert the / to \ in the path |
2087 | separators in the prefixpath yet because we do not | ||
2088 | know (until reset_cifs_unix_caps is called later) | ||
2089 | whether POSIX PATH CAP is available. We normalize | ||
2090 | the / to \ after reset_cifs_unix_caps is called */ | ||
2061 | volume_info.prepath = NULL; | 2091 | volume_info.prepath = NULL; |
2062 | } else | 2092 | } else |
2063 | cifs_sb->prepathlen = 0; | 2093 | cifs_sb->prepathlen = 0; |
@@ -2225,11 +2255,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2225 | else | 2255 | else |
2226 | tcon->unix_ext = 0; /* server does not support them */ | 2256 | tcon->unix_ext = 0; /* server does not support them */ |
2227 | 2257 | ||
2258 | /* convert forward to back slashes in prepath here if needed */ | ||
2259 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) == 0) | ||
2260 | convert_delimiter(cifs_sb->prepath, | ||
2261 | CIFS_DIR_SEP(cifs_sb)); | ||
2262 | |||
2228 | if ((tcon->unix_ext == 0) && (cifs_sb->rsize > (1024 * 127))) { | 2263 | if ((tcon->unix_ext == 0) && (cifs_sb->rsize > (1024 * 127))) { |
2229 | cifs_sb->rsize = 1024 * 127; | 2264 | cifs_sb->rsize = 1024 * 127; |
2230 | #ifdef CONFIG_CIFS_DEBUG2 | 2265 | cFYI(DBG2, |
2231 | cFYI(1, ("no very large read support, rsize now 127K")); | 2266 | ("no very large read support, rsize now 127K")); |
2232 | #endif | ||
2233 | } | 2267 | } |
2234 | if (!(tcon->ses->capabilities & CAP_LARGE_WRITE_X)) | 2268 | if (!(tcon->ses->capabilities & CAP_LARGE_WRITE_X)) |
2235 | cifs_sb->wsize = min(cifs_sb->wsize, | 2269 | cifs_sb->wsize = min(cifs_sb->wsize, |