diff options
-rw-r--r-- | Documentation/filesystems/vfat.txt | 2 | ||||
-rw-r--r-- | fs/fat/fat.h | 2 | ||||
-rw-r--r-- | fs/fat/inode.c | 18 | ||||
-rw-r--r-- | fs/fat/misc.c | 8 | ||||
-rw-r--r-- | fs/fat/namei_vfat.c | 15 | ||||
-rw-r--r-- | fs/nls/nls_base.c | 8 |
6 files changed, 26 insertions, 27 deletions
diff --git a/Documentation/filesystems/vfat.txt b/Documentation/filesystems/vfat.txt index b58b84b50fa2..eed520fd0c8e 100644 --- a/Documentation/filesystems/vfat.txt +++ b/Documentation/filesystems/vfat.txt | |||
@@ -102,7 +102,7 @@ shortname=lower|win95|winnt|mixed | |||
102 | winnt: emulate the Windows NT rule for display/create. | 102 | winnt: emulate the Windows NT rule for display/create. |
103 | mixed: emulate the Windows NT rule for display, | 103 | mixed: emulate the Windows NT rule for display, |
104 | emulate the Windows 95 rule for create. | 104 | emulate the Windows 95 rule for create. |
105 | Default setting is `lower'. | 105 | Default setting is `mixed'. |
106 | 106 | ||
107 | tz=UTC -- Interpret timestamps as UTC rather than local time. | 107 | tz=UTC -- Interpret timestamps as UTC rather than local time. |
108 | This option disables the conversion of timestamps | 108 | This option disables the conversion of timestamps |
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index adb0e72a176d..7db0979c6b72 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h | |||
@@ -323,7 +323,7 @@ extern int fat_flush_inodes(struct super_block *sb, struct inode *i1, | |||
323 | /* fat/misc.c */ | 323 | /* fat/misc.c */ |
324 | extern void fat_fs_error(struct super_block *s, const char *fmt, ...) | 324 | extern void fat_fs_error(struct super_block *s, const char *fmt, ...) |
325 | __attribute__ ((format (printf, 2, 3))) __cold; | 325 | __attribute__ ((format (printf, 2, 3))) __cold; |
326 | extern void fat_clusters_flush(struct super_block *sb); | 326 | extern int fat_clusters_flush(struct super_block *sb); |
327 | extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster); | 327 | extern int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster); |
328 | extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts, | 328 | extern void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts, |
329 | __le16 __time, __le16 __date, u8 time_cs); | 329 | __le16 __time, __le16 __date, u8 time_cs); |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 04629d1302fc..76b7961ab663 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -451,12 +451,16 @@ static void fat_write_super(struct super_block *sb) | |||
451 | 451 | ||
452 | static int fat_sync_fs(struct super_block *sb, int wait) | 452 | static int fat_sync_fs(struct super_block *sb, int wait) |
453 | { | 453 | { |
454 | lock_super(sb); | 454 | int err = 0; |
455 | fat_clusters_flush(sb); | ||
456 | sb->s_dirt = 0; | ||
457 | unlock_super(sb); | ||
458 | 455 | ||
459 | return 0; | 456 | if (sb->s_dirt) { |
457 | lock_super(sb); | ||
458 | sb->s_dirt = 0; | ||
459 | err = fat_clusters_flush(sb); | ||
460 | unlock_super(sb); | ||
461 | } | ||
462 | |||
463 | return err; | ||
460 | } | 464 | } |
461 | 465 | ||
462 | static void fat_put_super(struct super_block *sb) | 466 | static void fat_put_super(struct super_block *sb) |
@@ -812,7 +816,7 @@ static int fat_show_options(struct seq_file *m, struct vfsmount *mnt) | |||
812 | seq_puts(m, ",shortname=mixed"); | 816 | seq_puts(m, ",shortname=mixed"); |
813 | break; | 817 | break; |
814 | case VFAT_SFN_DISPLAY_LOWER | VFAT_SFN_CREATE_WIN95: | 818 | case VFAT_SFN_DISPLAY_LOWER | VFAT_SFN_CREATE_WIN95: |
815 | /* seq_puts(m, ",shortname=lower"); */ | 819 | seq_puts(m, ",shortname=lower"); |
816 | break; | 820 | break; |
817 | default: | 821 | default: |
818 | seq_puts(m, ",shortname=unknown"); | 822 | seq_puts(m, ",shortname=unknown"); |
@@ -963,7 +967,7 @@ static int parse_options(char *options, int is_vfat, int silent, int *debug, | |||
963 | opts->codepage = fat_default_codepage; | 967 | opts->codepage = fat_default_codepage; |
964 | opts->iocharset = fat_default_iocharset; | 968 | opts->iocharset = fat_default_iocharset; |
965 | if (is_vfat) { | 969 | if (is_vfat) { |
966 | opts->shortname = VFAT_SFN_DISPLAY_LOWER|VFAT_SFN_CREATE_WIN95; | 970 | opts->shortname = VFAT_SFN_DISPLAY_WINNT|VFAT_SFN_CREATE_WIN95; |
967 | opts->rodir = 0; | 971 | opts->rodir = 0; |
968 | } else { | 972 | } else { |
969 | opts->shortname = 0; | 973 | opts->shortname = 0; |
diff --git a/fs/fat/misc.c b/fs/fat/misc.c index 4e35be873e09..0f55f5cb732f 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c | |||
@@ -43,19 +43,19 @@ EXPORT_SYMBOL_GPL(fat_fs_error); | |||
43 | 43 | ||
44 | /* Flushes the number of free clusters on FAT32 */ | 44 | /* Flushes the number of free clusters on FAT32 */ |
45 | /* XXX: Need to write one per FSINFO block. Currently only writes 1 */ | 45 | /* XXX: Need to write one per FSINFO block. Currently only writes 1 */ |
46 | void fat_clusters_flush(struct super_block *sb) | 46 | int fat_clusters_flush(struct super_block *sb) |
47 | { | 47 | { |
48 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | 48 | struct msdos_sb_info *sbi = MSDOS_SB(sb); |
49 | struct buffer_head *bh; | 49 | struct buffer_head *bh; |
50 | struct fat_boot_fsinfo *fsinfo; | 50 | struct fat_boot_fsinfo *fsinfo; |
51 | 51 | ||
52 | if (sbi->fat_bits != 32) | 52 | if (sbi->fat_bits != 32) |
53 | return; | 53 | return 0; |
54 | 54 | ||
55 | bh = sb_bread(sb, sbi->fsinfo_sector); | 55 | bh = sb_bread(sb, sbi->fsinfo_sector); |
56 | if (bh == NULL) { | 56 | if (bh == NULL) { |
57 | printk(KERN_ERR "FAT: bread failed in fat_clusters_flush\n"); | 57 | printk(KERN_ERR "FAT: bread failed in fat_clusters_flush\n"); |
58 | return; | 58 | return -EIO; |
59 | } | 59 | } |
60 | 60 | ||
61 | fsinfo = (struct fat_boot_fsinfo *)bh->b_data; | 61 | fsinfo = (struct fat_boot_fsinfo *)bh->b_data; |
@@ -74,6 +74,8 @@ void fat_clusters_flush(struct super_block *sb) | |||
74 | mark_buffer_dirty(bh); | 74 | mark_buffer_dirty(bh); |
75 | } | 75 | } |
76 | brelse(bh); | 76 | brelse(bh); |
77 | |||
78 | return 0; | ||
77 | } | 79 | } |
78 | 80 | ||
79 | /* | 81 | /* |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index cb6e83557112..f565f24019b5 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -499,17 +499,10 @@ xlate_to_uni(const unsigned char *name, int len, unsigned char *outname, | |||
499 | int charlen; | 499 | int charlen; |
500 | 500 | ||
501 | if (utf8) { | 501 | if (utf8) { |
502 | int name_len = strlen(name); | 502 | *outlen = utf8s_to_utf16s(name, len, (wchar_t *)outname); |
503 | 503 | if (*outlen < 0) | |
504 | *outlen = utf8s_to_utf16s(name, PATH_MAX, (wchar_t *) outname); | 504 | return *outlen; |
505 | 505 | else if (*outlen > 255) | |
506 | /* | ||
507 | * We stripped '.'s before and set len appropriately, | ||
508 | * but utf8s_to_utf16s doesn't care about len | ||
509 | */ | ||
510 | *outlen -= (name_len - len); | ||
511 | |||
512 | if (*outlen > 255) | ||
513 | return -ENAMETOOLONG; | 506 | return -ENAMETOOLONG; |
514 | 507 | ||
515 | op = &outname[*outlen * sizeof(wchar_t)]; | 508 | op = &outname[*outlen * sizeof(wchar_t)]; |
diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c index 2224b4d07bf0..44a88a9fa2c8 100644 --- a/fs/nls/nls_base.c +++ b/fs/nls/nls_base.c | |||
@@ -124,10 +124,10 @@ int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs) | |||
124 | while (*s && len > 0) { | 124 | while (*s && len > 0) { |
125 | if (*s & 0x80) { | 125 | if (*s & 0x80) { |
126 | size = utf8_to_utf32(s, len, &u); | 126 | size = utf8_to_utf32(s, len, &u); |
127 | if (size < 0) { | 127 | if (size < 0) |
128 | /* Ignore character and move on */ | 128 | return -EINVAL; |
129 | size = 1; | 129 | |
130 | } else if (u >= PLANE_SIZE) { | 130 | if (u >= PLANE_SIZE) { |
131 | u -= PLANE_SIZE; | 131 | u -= PLANE_SIZE; |
132 | *op++ = (wchar_t) (SURROGATE_PAIR | | 132 | *op++ = (wchar_t) (SURROGATE_PAIR | |
133 | ((u >> 10) & SURROGATE_BITS)); | 133 | ((u >> 10) & SURROGATE_BITS)); |