Created attachment 161151 [details] patch__set uniquied to inode cache ////////////////////////////////////////////////////////// Description of problem: Old inode cache is used, when same filename and using ls -li <filename>. This causes that client shows wrong(old) inode number. When server is Windows, client has same problem. ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// 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. create file share service 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:45 a 4. remove and create files at samba server server# rm -rf a; touch b a; ls -li total 0 2400377 -rw-r--r--. 1 root root 0 Dec 18 09:45 a 2400376 -rw-r--r--. 1 root root 0 Dec 18 09:45 b 5. list file "directly" at CIFS client client# ls -li a b 2400376 -rw-r--r--. 1 root root 0 Dec 18 09:45 a 2400376 -rw-r--r--. 1 root root 0 Dec 18 09:45 b ///////////////////////////////////////// Client shows wrong(old) inode number. 2400377 is correct. ///////////////////////////////////////// ===================================================== This is patch. 002-cifs-fix-set-uniqueid-to-inodecache_WhenDirectRefer.patch But this patch is not applicable to when Server is Windows. ===================================================== You look similar problem at https://bugzilla.kernel.org/show_bug.cgi?id=90011 but there need different bug patches. Patching both 001 and 002 is better.
This looks wrong to me. The inode number is derived solely from the uniqueid, so you can't go and change that in place without rehashing the inode. If a dentry all of a sudden shows that it has a different inode number, then that dentry should be invalidated and a new one instantiated with the new inode. The right thing to do is to ensure that cifs_d_revalidate returns appropriately when the inode number changes.
Created attachment 161301 [details] patch__if different uniqueid, then return error
Thanks for review. I posted new patch (attachment 161301 [details]) which return error. (then cifs_d_revalidate return error, and make new dentry and inode) With this patch, next problem is little bit changed. "Limited at the time of the same inode number" https://bugzilla.kernel.org/show_bug.cgi?id=90031
Can not be reproduced in current kernel so has been fixed sometime in the past.