linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve French <smfrench@austin.rr.com>
To: linux-fsdevel@vger.kernel.org
Subject: [RFC PATCH] cleaning up negative dentries when remote directory is changed
Date: Thu, 24 Nov 2005 19:33:13 -0600	[thread overview]
Message-ID: <438669D9.7060505@austin.rr.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

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)
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?



[-- Attachment #2: dir-revalidate.patch --]
[-- Type: text/x-patch, Size: 1206 bytes --]

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 05b5258..45b67e9 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1039,14 +1042,18 @@ int cifs_revalidate(struct dentry *diren
 		filemap_fdatawrite(direntry->d_inode->i_mapping);
 	}
 	if (invalidate_inode) {
-		if (direntry->d_inode->i_mapping)
-			filemap_fdatawait(direntry->d_inode->i_mapping);
-		/* may eventually have to do this for open files too */
-		if (list_empty(&(cifsInode->openFileList))) {
-			/* Has changed on server - flush read ahead pages */
-			cFYI(1, ("Invalidating read ahead data on "
-				 "closed file"));
-			invalidate_remote_inode(direntry->d_inode);
+		if(S_ISDIR(direntry->d_inode->i_mode)) {
+			shrink_dcache_parent(direntry);
+		} else if (S_ISREG(direntry->d_inode->i_mode)) {
+			if (direntry->d_inode->i_mapping)
+				filemap_fdatawait(direntry->d_inode->i_mapping);
+			/* may eventually have to do this for open files too */
+			if (list_empty(&(cifsInode->openFileList))) {
+				/* changed on server - flush read ahead pages */
+				cFYI(1, ("Invalidating read ahead data on "
+					 "closed file"));
+				invalidate_remote_inode(direntry->d_inode);
+			}
 		}
 	}
 /*	up(&direntry->d_inode->i_sem); */

             reply	other threads:[~2005-11-25  1:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-25  1:33 Steve French [this message]
2005-11-25  1:55 ` [RFC PATCH] cleaning up negative dentries when remote directory is changed Trond Myklebust
2005-11-25  2:06   ` Steve French
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=438669D9.7060505@austin.rr.com \
    --to=smfrench@austin.rr.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /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).