The mkfifo(3) manual page explains several possible errno settings for mkfifo() failures, but fails to mention one: EPERM. For example, I am getting this error when trying to create a named pipe in a directory mounted on CIFS (Windows share): $ mkfifo a mkfifo: cannot create fifo 'a': Operation not permitted It appears that mknod(3) also gets the same error (EPERM) when trying to create a FIFO on a CIFS-mounted directory. Here, the manual page does mention EPERM, but it says it can only happen when the file type is *not* FIFO, but this is apparently not the whole story - it seems mknod() can fail with EPERM also on FIFO, if the filesystem does not support fifos. By the way, it can also fail with EPERM when trying to create other special files if the filesystem doesn't support them - even if the user has every possible permissions.
Works for me.Maybe samba configuration issue. You need to have a writeable user . The below tells that issue is not with cifs driver. root@junk-foo:/mnt/3# touch foo root@junk-foo:/mnt/3# ls -l foo -rw-r--r--+ 1 root root 0 Jun 1 10:20 foo root@junk-foo:/mnt/3# mknod foo b 4 3 mknod: foo: File exists root@junk-foo:/mnt/3# mknod devfoo b 4 3 root@junk-foo:/mnt/3# mkfifo pipe root@junk-foo:/mnt/3# ls -l total 0 brw-r--r-- 1 root root 4, 3 Jun 1 10:21 devfoo -rw-r--r-- 1 root root 0 Jun 1 10:20 foo prw-r--r-- 1 root root 0 Jun 1 10:21 pipe root@junk-foo:/mnt/3# uname -a Linux junk-foo 4.7.0-rc1+ #1 SMP Tue May 31 21:24:09 IST 2016 x86_64 x86_64 x86_64 GNU/Linux root@junk-foo:/mnt/3# mount | grep /mnt/3 //192.168.0.103/xyz on /mnt/3 type cifs (rw,relatime,vers=1.0,cache=strict,username=root,domain=JUNK-FOO,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.0.103,unix,posixpaths,serverino,mapposix,acl,rsize=1048576,wsize=65536,echo_interval=60,actimeo=1) root@junk-foo:/mnt/3#
I don't know why it worked for you and not for me, but I did paste the exact error message ("operation not permitted") I got from mkfifo ;-) Looking at the Linux source code, fs/cifs/dir.c, the cifs_mknod function, I see the lines causing this EPERM:: int rc = -EPERM; ... if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)) goto mknod_out; ... mknod_out: ... return rc; So it appears that if this "CIFS_MOUNT_UNX_EMUL" flag is not turned on, indeed an EPERM is being returned. I'm not sure who is supposed to turn on this flag (does it come from the server? is it a mount-time flag?), but I guess it can be off, and mknod() would result in EPERM. I'm not sure why the CIFS guys decided to return EPERM in this case (and not something else, like ENOSYS), but perhaps this decision has precedent in other drivers as well. I didn't check.
So, it's not clear to me. Do you still consider this to be a bug in the mkfio(3) and mknod(2) man pages?
I don't think so . This is not a bug. Please see below for the details. From mount command manpage For most types all the mount program has to do is issue a simple mount(2) system call, and no detailed knowledge of the filesystem type is required.For a few types however (like nfs, nfs4, cifs, smbfs, ncpfs) an ad hoc code is necessary. The nfs, nfs4, cifs, smbfs, and ncpfs filesystems have a separate mount program. In order to make it possible to treat all types in a uniform way, mount will execute the program /sbin/mount.type (if that exists) when called with type type. Since different versions of the smbmount program have different calling conventions, /sbin/mount.smbfs may have to be a shell script that sets up the desired call. Now looking at mount.cifs(8) From mount.cifs(8) from cifs-utils not related to kernel manpages. sfu When the CIFS Unix Extensions are not negotiated, attempt to create device files and fifos in a format compatible with Services for Unix (SFU). In addition retrieve bits 10-12 of the mode via the SETFILEBITS extended attribute (as SFU does). In the future the bottom 9 bits of the mode mode also will be emulated using queries of the security descriptor (ACL). [NB: requires version 1.39 or later of the CIFS VFS. To recognize symlinks and be able to create symlinks in an SFU interoperable form requires version 1.40 or later of the CIFS VFS kernel module. nounix Disable the CIFS Unix Extensions for this mount. This can be useful in order to turn off multiple settings at once. This includes POSIX acls, POSIX locks, POSIX paths, symlink support and retrieving uids/gids/mode from the erver. This can also be useful to work around a bug in a server that supports Unix Extensions. INODE NUMBERS When Unix Extensions are enabled, we use the actual inode number provided by the server in response to the POSIX calls as an inode number. When Unix Extensions are disabled and "serverino" mount option is enabled there is no way to get the server inode number. The client typically maps the server-assigned "UniqueID" onto an inode number. Note that the UniqueID is a different value from the server inode number. The UniqueID value is unique over the scope of the entire server and is often greater than 2 power 32. This value often makes programs that are not compiled with LFS (Large File Support), to trigger a glibc EOVERFLOW error as this won´t fit in the target structure field. It is strongly recommended to compile your programs with LFS support (i.e. with -D_FILE_OFFSET_BITS=64) to prevent this problem. You can also use "noserverino" mount option to generate inode numbers smaller than 2 power 32 on the client. But you may not be able to detect hardlinks properly. Here is for volume smb running on ubuntu , this CIFS extensions are coming from server smbclient -N //127.0.0.1/Movies -c "posix" WARNING: The "syslog" option is deprecated Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.3.9-Ubuntu] Server supports CIFS extensions 1.0 Server supports CIFS capabilities locks acls pathnames posix_path_operations large_read posix_encrypt junk@junk-foo:~/android/samba-4.4.5/source3$ smbclient -N //127.0.0.1/Movies -c "volume" WARNING: The "syslog" option is deprecated Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.3.9-Ubuntu] Volume: |Movies| serial number 0x735d0d3c junk@junk-foo:~/android/samba-4.4.5/source3$ win10 Domain=[DESKTOP-T9GDCOU] OS=[Windows 10 Pro 10240] Server=[Windows 10 Pro 6.3] smb: \> posix Server doesn't support UNIX CIFS extensions. smb: \> root@junk-foo:/mnt/24# touch foo root@junk-foo:/mnt/24# ls -l foo -rwxr-xr-x 1 root root 0 Jul 8 20:11 foo root@junk-foo:/mnt/24# mkfifo abcd mkfifo: cannot create fifo 'abcd': Operation not permitted root@junk-foo:/mnt/24# ls foo root@junk-foo:/mnt/24# mknod dev b 1 2 mknod: dev: Operation not permitted root@junk-foo:/mnt/24# mount | grep PerfLogs //192.168.122.12/PerfLogs on /mnt/24 type cifs (rw,relatime,vers=1.0,cache=strict,username=junk,domain=DESKTOP-T9GDCOU,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.122.12,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,rsize=61440,wsize=65536,echo_interval=60,actimeo=1) Default mount.smbfs disables this creation below it does with nounix option and without sfu. Now add sfu option and mount root@junk-foo:/mnt/24# mount | grep PerfLogs //192.168.122.12/PerfLogs on /mnt/24 type cifs (rw,relatime,vers=1.0,cache=strict,username=junk,domain=DESKTOP-T9GDCOU,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.122.12,file_mode=0755,dir_mode=0755,nounix,serverino,mapposix,sfu,dynperm,rsize=61440,wsize=65536,echo_interval=60,actimeo=1) root@junk-foo:/mnt/24# mknod devsmb b 1 2 root@junk-foo:/mnt/24# mkfifo fifosmb root@junk-foo:/mnt/24# ls devsmb fifosmb foo newfoo root@junk-foo:/mnt/24# cd root@junk-foo:~# umount /mnt/24 root@junk-foo:~# Now without dynperm mount.cifs //192.168.122.12/PerfLogs /mnt/24 -o user=junk,dom=DESKTOP-T9GDCOU,sfu Password for junk@//192.168.122.12/PerfLogs: ********* root@junk-foo:~# cd /mnt/24 root@junk-foo:/mnt/24# ls devsmb fifosmb foo newfoo root@junk-foo:/mnt/24# ls -l total 1 brwxr-xr-x 1 root root 1, 2 Jul 8 20:13 devsmb prwxr-xr-x 1 root root 0 Jul 8 20:14 fifosmb -rwxr-xr-x 1 root root 0 Jul 8 20:11 foo -rwxr-xr-x 1 root root 0 Jul 8 20:12 newfoo root@junk-foo:/mnt/24# mkfifo newsmbfifo root@junk-foo:/mnt/24# ls -l total 1 brwxr-xr-x 1 root root 1, 2 Jul 8 20:13 devsmb prwxr-xr-x 1 root root 0 Jul 8 20:14 fifosmb -rwxr-xr-x 1 root root 0 Jul 8 20:11 foo -rwxr-xr-x 1 root root 0 Jul 8 20:12 newfoo prwxr-xr-x 1 root root 0 Jul 8 20:15 newsmbfifo root@junk-foo:/mnt/24# It is clear that even though the server doesn't support we can still create fifos and mknod and if the server does support you definitely can.
(In reply to Navin from comment #4) > I don't think so . This is not a bug. Okay -- closing. Cheers, Michael