linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve French <smfrench@austin.rr.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [RFC PATCH] cleaning up negative dentries when remote	directory is changed
Date: Thu, 24 Nov 2005 20:06:31 -0600	[thread overview]
Message-ID: <438671A7.4060809@austin.rr.com> (raw)
In-Reply-To: <1132883741.8985.24.camel@lade.trondhjem.org>

Trond Myklebust wrote:
> On Thu, 2005-11-24 at 19:33 -0600, Steve French wrote:
>   
>> Due to the dcache caching negative dentries, files which were deleted on 
>> the client (if it resulted in a negative denty) and soon after readded 
>> on the server would still appear deleted to stat (lookup) at least for 
>> the case of cifs .   Although a readdir would readd the positive dentry, 
>> it would be nice to invalidate negative dentries if the client sees that 
>> the parent directory changed (on the server) so that the negative 
>> dentries would get tossed.   Looking around some other examples, it 
>> looks like at least two (coda, nfs) handle this by calling
>>     shrink_dcache_parent(dentry)
>>     
>
> No they don't. shrink_dcache_parent() gets rid of _all_ unused child
> dentries, which is worse than not caching the negative dentry.
>
> d_drop() is the right thing to do when you are talking about a single
> dentry.
>
>   
>> which is the obvious way to do this (as in the attached patch which 
>> seems to work for cifs and address the reported bug).   Is there a 
>> better way to remove the negative dentries (which may no longer be 
>> negative) under a changed directory?
>>     
>
> The way we do it in NFS is that we check the mtime of the parent
> directory. If the latter has changed since the last time we revalidated
> the negative dentry we call d_drop() in order to force a new lookup (the
> timestamp is stored in dentry->d_time).
>
>   
I don't even see any code in my vfs being called on the negative dentry 
other than
the lookup on the parent e.g:
    ls /mnt/modified_dir/deleted_file

I see that the lookup on modified_dir hits cifs's dentry_revalidate 
routine but there is
no call to dentry_revalidate on "deleted_file" ... does nfs export some 
magic dentry
routines other than revalidate?

> In order to deal with the (rare) case where the server does not support
> mtime, we also have a hard limit on the lifetime of the negative dentry.
>
> Cheers,
>   Trond
>
>
>   


  reply	other threads:[~2005-11-25  2:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-25  1:33 [RFC PATCH] cleaning up negative dentries when remote directory is changed Steve French
2005-11-25  1:55 ` Trond Myklebust
2005-11-25  2:06   ` Steve French [this message]
2005-11-25  2:18     ` Trond Myklebust
2005-11-25  2:29       ` Steve French

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=438671A7.4060809@austin.rr.com \
    --to=smfrench@austin.rr.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=trond.myklebust@fys.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).