Created attachment 161141 [details] patch__if different file type, then return error ////////////////////////////////////////////////////////// Description of problem: In spite of different file type, if file is same name and same inode number, then old inode cache is used. This causes that you can not cd directory, can not cat SymbolicLink. ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// Version-Release number of selected component (if applicable): CIFS client: kernel-3.18.0 samba server: samba-4.1.12-5.rc20 ////////////////////////////////////////////////////////// How reproducible: Steps to Reproduce: 1. start smb at samba server server# setenforce 0 server# vi /etc/samba/smb.conf [share] path = /home/share public = yes writable = yes server# smbpasswd -a XXX(username) server# systemctl restart smb 2. mount cifs at CIFS client client# mount -o user=XXX,serverino //server/share /mnt/share 3. create and list file at CIFS client client# cd /mnt/share client# touch a; ls -li total 0 2400376 -rw-r--r--. 1 root root 0 Dec 18 09:37 a 4. remove file and create Directory at samba server (Maybe you need repeat rm and mkdir 4 times until same inode number directory is made.) server# rm -rf a; mkdir a; ls -li total 0 2400376 drwxr-xr-x. 2 root root 0 Dec 18 09:38 a 5. list at CIFS client client# ls -li total 0 2400376 drwxr-xr-x. 2 root root 0 Dec 18 09:38 a client# cd a bash: cd: a: Not a directory 6. cannot remove DIR at CIFS client client# rm -rf a clinet$ ls -li total 0 2400376 drwxr-xr-x. 2 root root 0 Dec 18 09:38 a <<Fedora20 when SELinux is Enforcing, can not remove DIR>> client# getenforce Enforcing client# rm -rf a rm: cannot remove 'a': Permission denied ===================================================== This is patch. 001-cifs-fix-different-mode-return-error.patch =====================================================
Huh -- wonder why the inode number didn't change? Is it just the lower fs recycling inode numbers? In any case, patch looks reasonable to me. You should go ahead and send it (along with a description of the problem) to linux-cifs@vger.kernel.org.
Thanks for review. You repeat rm and mkdir 4 times at server, then server recycles same inode number.
Fix merged into cifs-2.6.git and mainline