aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-06-26 00:47:28 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-06-26 00:47:28 -0400
commitd7933ab727ed035bdf420d7381b831ba959cecc5 (patch)
treea2487fa428682fadbd62f57a27bd080f5a31567f /fs
parent2a80ff867f35b39b27564eb006103966f90f10ea (diff)
parentce36d9ab3bab06b7b5522f5c8b68fac231b76ffb (diff)
Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6
Pull CIFS fixes from Steve French: "Small set of misc cifs/smb3 fixes" * 'for-next' of git://git.samba.org/sfrench/cifs-2.6: [CIFS] fix mount failure with broken pathnames when smb3 mount with mapchars option cifs: revalidate mapping prior to satisfying read_iter request with cache=loose fs/cifs: fix regression in cifs_create_mf_symlink()
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifs_unicode.c7
-rw-r--r--fs/cifs/cifsfs.c17
-rw-r--r--fs/cifs/link.c2
3 files changed, 20 insertions, 6 deletions
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
index 0227b45ef00a..15e9505aa35f 100644
--- a/fs/cifs/cifs_unicode.c
+++ b/fs/cifs/cifs_unicode.c
@@ -290,7 +290,8 @@ int
290cifsConvertToUTF16(__le16 *target, const char *source, int srclen, 290cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
291 const struct nls_table *cp, int mapChars) 291 const struct nls_table *cp, int mapChars)
292{ 292{
293 int i, j, charlen; 293 int i, charlen;
294 int j = 0;
294 char src_char; 295 char src_char;
295 __le16 dst_char; 296 __le16 dst_char;
296 wchar_t tmp; 297 wchar_t tmp;
@@ -298,12 +299,11 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
298 if (!mapChars) 299 if (!mapChars)
299 return cifs_strtoUTF16(target, source, PATH_MAX, cp); 300 return cifs_strtoUTF16(target, source, PATH_MAX, cp);
300 301
301 for (i = 0, j = 0; i < srclen; j++) { 302 for (i = 0; i < srclen; j++) {
302 src_char = source[i]; 303 src_char = source[i];
303 charlen = 1; 304 charlen = 1;
304 switch (src_char) { 305 switch (src_char) {
305 case 0: 306 case 0:
306 put_unaligned(0, &target[j]);
307 goto ctoUTF16_out; 307 goto ctoUTF16_out;
308 case ':': 308 case ':':
309 dst_char = cpu_to_le16(UNI_COLON); 309 dst_char = cpu_to_le16(UNI_COLON);
@@ -350,6 +350,7 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen,
350 } 350 }
351 351
352ctoUTF16_out: 352ctoUTF16_out:
353 put_unaligned(0, &target[j]); /* Null terminate target unicode string */
353 return j; 354 return j;
354} 355}
355 356
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 2c90d07c0b3a..888398067420 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -725,6 +725,19 @@ out_nls:
725 goto out; 725 goto out;
726} 726}
727 727
728static ssize_t
729cifs_loose_read_iter(struct kiocb *iocb, struct iov_iter *iter)
730{
731 ssize_t rc;
732 struct inode *inode = file_inode(iocb->ki_filp);
733
734 rc = cifs_revalidate_mapping(inode);
735 if (rc)
736 return rc;
737
738 return generic_file_read_iter(iocb, iter);
739}
740
728static ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) 741static ssize_t cifs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
729{ 742{
730 struct inode *inode = file_inode(iocb->ki_filp); 743 struct inode *inode = file_inode(iocb->ki_filp);
@@ -881,7 +894,7 @@ const struct inode_operations cifs_symlink_inode_ops = {
881const struct file_operations cifs_file_ops = { 894const struct file_operations cifs_file_ops = {
882 .read = new_sync_read, 895 .read = new_sync_read,
883 .write = new_sync_write, 896 .write = new_sync_write,
884 .read_iter = generic_file_read_iter, 897 .read_iter = cifs_loose_read_iter,
885 .write_iter = cifs_file_write_iter, 898 .write_iter = cifs_file_write_iter,
886 .open = cifs_open, 899 .open = cifs_open,
887 .release = cifs_close, 900 .release = cifs_close,
@@ -939,7 +952,7 @@ const struct file_operations cifs_file_direct_ops = {
939const struct file_operations cifs_file_nobrl_ops = { 952const struct file_operations cifs_file_nobrl_ops = {
940 .read = new_sync_read, 953 .read = new_sync_read,
941 .write = new_sync_write, 954 .write = new_sync_write,
942 .read_iter = generic_file_read_iter, 955 .read_iter = cifs_loose_read_iter,
943 .write_iter = cifs_file_write_iter, 956 .write_iter = cifs_file_write_iter,
944 .open = cifs_open, 957 .open = cifs_open,
945 .release = cifs_close, 958 .release = cifs_close,
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 264ece71bdb2..68559fd557fb 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -374,7 +374,7 @@ cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
374 oparms.cifs_sb = cifs_sb; 374 oparms.cifs_sb = cifs_sb;
375 oparms.desired_access = GENERIC_WRITE; 375 oparms.desired_access = GENERIC_WRITE;
376 oparms.create_options = create_options; 376 oparms.create_options = create_options;
377 oparms.disposition = FILE_OPEN; 377 oparms.disposition = FILE_CREATE;
378 oparms.path = path; 378 oparms.path = path;
379 oparms.fid = &fid; 379 oparms.fid = &fid;
380 oparms.reconnect = false; 380 oparms.reconnect = false;