diff options
author | Steve French <sfrench@us.ibm.com> | 2005-11-28 11:16:13 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2005-11-28 11:16:13 -0500 |
commit | 3abb92722ab1784b419dadb5444daf8ea9636905 (patch) | |
tree | 10e8eac9df4380542fb8416137dffe3b8c08ad54 /fs | |
parent | 458af5439fe7ae7d95ca14106844e61f0795166c (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')
-rw-r--r-- | fs/cifs/CHANGES | 8 | ||||
-rw-r--r-- | fs/cifs/dir.c | 25 | ||||
-rw-r--r-- | fs/cifs/inode.c | 22 |
3 files changed, 35 insertions, 20 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 6bded10c0d50..c40bd0df80ad 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -1,10 +1,12 @@ | |||
1 | Version 1.39 | 1 | Version 1.39 |
2 | ------------ | 2 | ------------ |
3 | Defer close of a file handle slightly if pending writes depend on that file handle | 3 | Defer close of a file handle slightly if pending writes depend on that handle |
4 | (this reduces the EBADF bad file handle errors that can be logged under heavy | 4 | (this reduces the EBADF bad file handle errors that can be logged under heavy |
5 | stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2 | 5 | stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2 |
6 | Fix SFU style symlinks and mknod needed for servers which do not support the CIFS | 6 | Fix SFU style symlinks and mknod needed for servers which do not support the |
7 | Unix Extensions. Fix setfacl/getfacl on bigendian. | 7 | CIFS Unix Extensions. Fix setfacl/getfacl on bigendian. Timeout negative |
8 | dentries so files that the client sees as deleted but that later get created | ||
9 | on the server will be recognized. | ||
8 | 10 | ||
9 | Version 1.38 | 11 | Version 1.38 |
10 | ------------ | 12 | ------------ |
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 | ||
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 05b525812adb..d34325c887c4 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1039,14 +1039,20 @@ int cifs_revalidate(struct dentry *direntry) | |||
1039 | filemap_fdatawrite(direntry->d_inode->i_mapping); | 1039 | filemap_fdatawrite(direntry->d_inode->i_mapping); |
1040 | } | 1040 | } |
1041 | if (invalidate_inode) { | 1041 | if (invalidate_inode) { |
1042 | if (direntry->d_inode->i_mapping) | 1042 | /* shrink_dcache not necessary now that cifs dentry ops |
1043 | filemap_fdatawait(direntry->d_inode->i_mapping); | 1043 | are exported for negative dentries */ |
1044 | /* may eventually have to do this for open files too */ | 1044 | /* if(S_ISDIR(direntry->d_inode->i_mode)) |
1045 | if (list_empty(&(cifsInode->openFileList))) { | 1045 | shrink_dcache_parent(direntry); */ |
1046 | /* Has changed on server - flush read ahead pages */ | 1046 | if (S_ISREG(direntry->d_inode->i_mode)) { |
1047 | cFYI(1, ("Invalidating read ahead data on " | 1047 | if (direntry->d_inode->i_mapping) |
1048 | "closed file")); | 1048 | filemap_fdatawait(direntry->d_inode->i_mapping); |
1049 | invalidate_remote_inode(direntry->d_inode); | 1049 | /* may eventually have to do this for open files too */ |
1050 | if (list_empty(&(cifsInode->openFileList))) { | ||
1051 | /* changed on server - flush read ahead pages */ | ||
1052 | cFYI(1, ("Invalidating read ahead data on " | ||
1053 | "closed file")); | ||
1054 | invalidate_remote_inode(direntry->d_inode); | ||
1055 | } | ||
1050 | } | 1056 | } |
1051 | } | 1057 | } |
1052 | /* up(&direntry->d_inode->i_sem); */ | 1058 | /* up(&direntry->d_inode->i_sem); */ |