Created attachment 165361 [details]
cifs downgrade patch to versions of Kernel 3.17.8
There is a bug in character conversations on clients using cifs.
Files or directories with :, *, ?, >, <, etc. in its name are shown corectly but the access to these files fails. The cifs client can create such files but it is not possible to remove or rename the files.
An access to such files shows an empty file in some circumstances.
My actual solution is to remove all conversion patches since Kernel 3.17.8.
The patch downgrades the cifs module to the state of Kernel 3.17.8 with only the necessary adaptations to work with Kernel 3.18.x.
There is a related issue reported in the Samba Bugzilla:
This bug is still present in kernel 4.1.12.
Looking into this...
This is fixed in the current kernel.
$ touch /mnt/foo\<\*\>\?
$ ls -l /mnt/foo\<\*\>\?
-rwxr-xr-x. 1 root root 0 Feb 7 15:15 '/mnt/foo<*>?'
$ echo "Hello World" > /mnt/foo\<\*\>\?
$ cat /mnt/foo\<\*\>\?
$ rm /mnt/foo\<\*\>\?
(In reply to Ronnie Sahlberg from comment #5)
> This is fixed in the current kernel.
> $ touch /mnt/foo\<\*\>\?
> $ ls -l /mnt/foo\<\*\>\?
> -rwxr-xr-x. 1 root root 0 Feb 7 15:15 '/mnt/foo<*>?'
> $ echo "Hello World" > /mnt/foo\<\*\>\?
> $ cat /mnt/foo\<\*\>\?
> Hello World
> $ rm /mnt/foo\<\*\>\?
Is /mnt/foo/ a CIFS mountpoint?
/mnt is an smb mountpoint
foo/</*/>/? is a file in this share
$ mount | grep /mnt
//win16-1/Share on /mnt type cifs (rw,relatime,vers=3.0,cache=strict,username=sahlberg,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.124.198,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,mfsymlinks,noperm,rsize=4194304,wsize=4194304,echo_interval=60,actimeo=1)
This was resolved and enabled by default for SMB2/SMB3 mounts more than four years ago, but there was this patch which may be important for your use case which certainly should be in by 4.2 kernel. Make sure your /proc/mounts mount entry for this cifs mount shows "mapposix"
Author: Nakajima Akira <firstname.lastname@example.org>
Date: Fri Feb 13 15:35:58 2015 +0900
Fix that several functions handle incorrect value of mapchars
Cifs client has problem with reserved chars filename.
[BUG1] : several functions handle incorrect value of mapchars
- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
[BUG2] : forget to convert reserved chars when creating SymbolicLink.
- CIFSUnixCreateSymLink() calls cifs_strtoUTF16
+ CIFSUnixCreateSymLink() calls cifsConvertToUTF16() with remap
[BUG3] : forget to convert reserved chars when getting SymbolicLink.
- CIFSSMBUnixQuerySymLink() calls cifs_strtoUTF16
+ CIFSSMBUnixQuerySymLink() calls cifsConvertToUTF16() with remap
[BUG4] : /proc/mounts don't show "mapposix" when using mapposix mount option
+ cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SFM_CHR)
+ seq_puts(s, ",mapposix");