aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/dir.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-11-28 11:16:13 -0500
committerSteve French <sfrench@us.ibm.com>2005-11-28 11:16:13 -0500
commit3abb92722ab1784b419dadb5444daf8ea9636905 (patch)
tree10e8eac9df4380542fb8416137dffe3b8c08ad54 /fs/cifs/dir.c
parent458af5439fe7ae7d95ca14106844e61f0795166c (diff)
[CIFS] When file is deleted locally but later recreated on the server
fix cifs negative dentries so they are freed faster (not requiring umount or readdir e.g.) so the client recognizes the new file on the server more quickly. Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/dir.c')
-rw-r--r--fs/cifs/dir.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 16b21522e8fe..aa4ea965b329 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -465,12 +465,20 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
465 direntry->d_op = &cifs_dentry_ops; 465 direntry->d_op = &cifs_dentry_ops;
466 d_add(direntry, newInode); 466 d_add(direntry, newInode);
467 467
468 /* since paths are not looked up by component - the parent directories are presumed to be good here */ 468 /* since paths are not looked up by component - the parent
469 directories are presumed to be good here */
469 renew_parental_timestamps(direntry); 470 renew_parental_timestamps(direntry);
470 471
471 } else if (rc == -ENOENT) { 472 } else if (rc == -ENOENT) {
472 rc = 0; 473 rc = 0;
474 direntry->d_time = jiffies;
475 if (pTcon->nocase)
476 direntry->d_op = &cifs_ci_dentry_ops;
477 else
478 direntry->d_op = &cifs_dentry_ops;
473 d_add(direntry, NULL); 479 d_add(direntry, NULL);
480 /* if it was once a directory (but how can we tell?) we could do
481 shrink_dcache_parent(direntry); */
474 } else { 482 } else {
475 cERROR(1,("Error 0x%x on cifs_get_inode_info in lookup of %s", 483 cERROR(1,("Error 0x%x on cifs_get_inode_info in lookup of %s",
476 rc,full_path)); 484 rc,full_path));
@@ -489,21 +497,20 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
489{ 497{
490 int isValid = 1; 498 int isValid = 1;
491 499
492/* lock_kernel(); *//* surely we do not want to lock the kernel for a whole network round trip which could take seconds */
493
494 if (direntry->d_inode) { 500 if (direntry->d_inode) {
495 if (cifs_revalidate(direntry)) { 501 if (cifs_revalidate(direntry)) {
496 /* unlock_kernel(); */
497 return 0; 502 return 0;
498 } 503 }
499 } else { 504 } else {
500 cFYI(1, 505 cFYI(1, ("neg dentry 0x%p name = %s",
501 ("In cifs_d_revalidate with no inode but name = %s and dentry 0x%p", 506 direntry, direntry->d_name.name));
502 direntry->d_name.name, direntry)); 507 if(time_after(jiffies, direntry->d_time + HZ) ||
508 !lookupCacheEnabled) {
509 d_drop(direntry);
510 isValid = 0;
511 }
503 } 512 }
504 513
505/* unlock_kernel(); */
506
507 return isValid; 514 return isValid;
508} 515}
509 516