configuration: PPC-Linux 2.6.9 client + cifs v1.39 mounts a Windows XP share as '/mshare' problem: 1. client: accesses existent /mshare/file -> no error: OK 2. client: removes /mshare/file and tries to access it afterwards -> EBADF: OK 3. server: (re-)creates /mshare/file 4. client tries to access (now existent) /mshare/file -> still EBADF: not OK 5. client: remains in that state until a readdir() e.g. using 'ls' is done -> after that client can (again) successfully access the /mshare/file I tried some /proc/fs tweaks (e.g Lookupcache), but no change of that behaviour :( The basic problem seems that the client doesn't recognize/is not notified about server side dir-contents changes. Maybe it's an option to re-fresh the file-status if an apparently non-existent file is accessed.
This has not been as easy for me to recreate as I had expected based on the problem description - even to Windows (not just with Samba server). Perhaps the readahead logic in the Linux memory manager is reading ahead so far that it is making it hard to seek far enough in the file to force a real read from the server - but this depends on how many times the file is open (oplock).
A small testcase would help.
I have this issue - x68 kernel 2.6.12-r4 - share is on a Win2k server - below is a test case: cifs mount point is /ntsvr where /ntsvr/tmp/a does not exist # ls /ntsvr/tmp/a fails as expeted # touch /ntsvr/tmp/a # ls /ntsvr/tmp/a succeeds file exists # rm /ntsvr/tmp/a succeeds # ls /ntsvr/tmp/a fails as expected now create the /ntsvr/tmp/a file from a windows machine which also has the /ntsvr share mounted (unsure if creating the file on the server has the same effect). # ls /ntsvr/tmp/a fails, this is not expected as i have just created the file # ls /ntsvr/tmp/a continues to fail until the following command is given # ls /ntsvr/tmp/ this shows the file exists # ls /ntsvr/tmp/a succeeds Hope this is of some help to you.
thx - that scenario did recreate the problem on my test system. There is a problem with recognizing changed directory entries and removing negative dentries. I am examining it.
Created attachment 1591 [details] Fix for server side new directory entries (that replace negative dentries) This should fix the problem with revalidate not removing negative dentries (for deleted/readded files)
Created attachment 1592 [details] Fix for server side new directory entries (that replace negative dentries) This should fix the problem with revalidate not removing negative dentries (for deleted/readded files)
The patch fixed the problem for me, thank you for your fast response (very impressed).
Created attachment 1593 [details] a slightly better form of the previous patch Let me know if this also works - this does not flush all dentries on a modified dir - just those those negative ones that we have not looked up recently (withink 1 second)
Holy shit - it works ... hey man - fantastic job !!! And please forgive me that I didn't support you with more details / testcases. I got too much pressure and there was no time left - sorry :( Meanwhile I used a scripted 'ls' which is obviously a poor workaround. Thank's a lot ! PS: I applied your latest patch to v1.39 @ PPC linux 2.6.9.