diff options
author | Steve French <sfrench@us.ibm.com> | 2006-11-16 15:54:20 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2006-11-16 15:54:20 -0500 |
commit | 31ec35d6c81175016a6372571eab23b6bd40b406 (patch) | |
tree | d5c63155e27e23d9704fda1831498f752ee348aa | |
parent | 237ee312e10a86e69e01fc02e0daeb0fa3e7a6e8 (diff) |
[CIFS] Incorrect hardlink count when original file is cached (oplocked)
Fixes Samba bug 2823
In this case hardlink count is stale for one of the two inodes (ie the
original file) until it is closed - since revalidate does not go to
server while file is cached locally.
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r-- | fs/cifs/link.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 0bee8b7e521a..8e259969354b 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
@@ -69,17 +69,30 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, | |||
69 | rc = -EOPNOTSUPP; | 69 | rc = -EOPNOTSUPP; |
70 | } | 70 | } |
71 | 71 | ||
72 | /* if (!rc) */ | 72 | d_drop(direntry); /* force new lookup from server of target */ |
73 | { | 73 | |
74 | /* renew_parental_timestamps(old_file); | 74 | /* if source file is cached (oplocked) revalidate will not go to server |
75 | inode->i_nlink++; | 75 | until the file is closed or oplock broken so update nlinks locally */ |
76 | mark_inode_dirty(inode); | 76 | if(old_file->d_inode) { |
77 | d_instantiate(direntry, inode); */ | 77 | cifsInode = CIFS_I(old_file->d_inode); |
78 | /* BB add call to either mark inode dirty or refresh its data and timestamp to current time */ | 78 | if(rc == 0) { |
79 | old_file->d_inode->i_nlink++; | ||
80 | old_file->d_inode->i_ctime = CURRENT_TIME; | ||
81 | /* parent dir timestamps will update from srv | ||
82 | within a second, would it really be worth it | ||
83 | to set the parent dir cifs inode time to zero | ||
84 | to force revalidate (faster) for it too? */ | ||
85 | } | ||
86 | /* if not oplocked will force revalidate to get info | ||
87 | on source file from srv */ | ||
88 | cifsInode->time = 0; | ||
89 | |||
90 | /* Will update parent dir timestamps from srv within a second. | ||
91 | Would it really be worth it to set the parent dir (cifs | ||
92 | inode) time field to zero to force revalidate on parent | ||
93 | directory faster ie | ||
94 | CIFS_I(inode)->time = 0; */ | ||
79 | } | 95 | } |
80 | d_drop(direntry); /* force new lookup from server */ | ||
81 | cifsInode = CIFS_I(old_file->d_inode); | ||
82 | cifsInode->time = 0; /* will force revalidate to go get info when needed */ | ||
83 | 96 | ||
84 | cifs_hl_exit: | 97 | cifs_hl_exit: |
85 | kfree(fromName); | 98 | kfree(fromName); |