Bug 3206 - caching problem accessing non-existing -> existing files ?
Summary: caching problem accessing non-existing -> existing files ?
Status: RESOLVED FIXED
Alias: None
Product: CifsVFS
Classification: Unclassified
Component: kernel fs (show other bugs)
Version: 2.6
Hardware: PPC Linux
: P3 normal
Target Milestone: ---
Assignee: Steve French
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-24 11:50 UTC by Hartmut Schaefer
Modified: 2005-11-25 13:41 UTC (History)
1 user (show)

See Also:


Attachments
Fix for server side new directory entries (that replace negative dentries) (1.18 KB, text/plain)
2005-11-24 18:17 UTC, Steve French
no flags Details
Fix for server side new directory entries (that replace negative dentries) (1.18 KB, patch)
2005-11-24 18:17 UTC, Steve French
no flags Details
a slightly better form of the previous patch (2.89 KB, patch)
2005-11-25 10:26 UTC, Steve French
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hartmut Schaefer 2005-10-24 11:50:42 UTC
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.
Comment 1 Steve French 2005-10-24 13:06:27 UTC
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).
Comment 2 Steve French 2005-10-24 13:06:58 UTC
A small testcase would help.
Comment 3 Len Meakin 2005-11-24 09:28:06 UTC
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.




Comment 4 Steve French 2005-11-24 16:36:22 UTC
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.
Comment 5 Steve French 2005-11-24 18:17:29 UTC
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)
Comment 6 Steve French 2005-11-24 18:17:38 UTC
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)
Comment 7 Len Meakin 2005-11-25 00:54:29 UTC
The patch fixed the problem for me, thank you for your fast response (very impressed).
Comment 8 Steve French 2005-11-25 10:26:06 UTC
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)
Comment 9 Hartmut Schaefer 2005-11-25 13:41:16 UTC
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.