RE: Query related to lookup
RE: Query related to lookup
- Subject: RE: Query related to lookup
- From: Pratima Kudale <email@hidden>
- Date: Wed, 10 Apr 2013 14:14:56 -0700
- Acceptlanguage: en-US
- Thread-topic: Query related to lookup
Ken,
Thanks for patiently replying my queries. I am novice to freebsd and Darwin kernel. So far I have 3 options to achieve periodic invalidation of name cache entries:
1. callback which will purge name cache when file / dir is deleted or renamed remotely.
2. Implement custom name cache and don't use vfs name cache
3. Utilize OSx provided name cache and see if I could invalidate name cache entries periodically.
Before I finalize on which route to take, I wanted to see if option-3 is feasible by using auth cache timeout to trigger periodic lookup calls.
About your comment:
>>I think the idea there is that if the directory credential timestamp has expired you need to go back through the noncached code path to make sure you have permission to search the directory; that has >> the effect of calling lookup again.
I also had similar thoughts when I read that code. For that matter smbfs and nfs both seems to be setting this ttl value.
Ideally, looking at cache_lookup_path code, if during mount I have set ttl to 3 secs [by calling vfs_setauthcache_ttl(mp, 3)].
Then for my test program:
For (int i=0; i<10; i++)
{
Stat(\mountpoint\dir1\file1);
Sleep(10 secs);
}
I should see 20 lookup calls for sure [(1 for dir1 + 1 for file1) * 20]. I performed this test just after mount, no other application [like finder] is referring this path.
But dtrace displayed only 2 lookup calls for above test.
Only way to see lookup for every stat syscall, was to disable auth cache by calling vfs_setauthcache_ttl(mp, 0)
That's why I am confused about this ttl value: what does it controls, why setting non-zero ttl doesn't result into periodic lookup calls.
Thanks,
Pratima
-----Original Message-----
From: Ken Hornstein [mailto:email@hidden]
Sent: Wednesday, April 10, 2013 6:44 AM
To: Pratima Kudale
Cc: Pratima Kudale; email@hidden
Subject: Re: Query related to lookup
>By staring and experimenting in last few days: I saw that I could cause
>VFS to send me a lookup call for every stat() syscall, if I call below
>function for a mountpoint: Vfs_setauthcache_ttl(mp, 0);
>
>Above call is supposed to disable auth cache, I am still confused about
>why affects lookup behavior. If you know more details about it, please
>let me know.
You _do_ know all of the kernel source code is available, right?
It looks like ... vfs_setauthcache_ttl() sets the mount flag MNTK_AUTH_OPAQUE, which sets the flag ttl_enabled to be TRUE in cache_lookup_path(), which invokes this code in the main loop in that function:
if (ttl_enabled && ((tv.tv_sec - dp->v_cred_timestamp) > dp->v_mount->mnt_authcache_ttl))
break;
I think the idea there is that if the directory credential timestamp has expired you need to go back through the noncached code path to make sure you have permission to search the directory; that has the effect of calling lookup again.
--Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden