Commit 31ec35d6 authored by Steve French's avatar Steve French

[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: default avatarSteve French <sfrench@us.ibm.com>
parent 237ee312
...@@ -69,17 +69,30 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, ...@@ -69,17 +69,30 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;
} }
/* if (!rc) */ d_drop(direntry); /* force new lookup from server of target */
{
/* renew_parental_timestamps(old_file); /* if source file is cached (oplocked) revalidate will not go to server
inode->i_nlink++; until the file is closed or oplock broken so update nlinks locally */
mark_inode_dirty(inode); if(old_file->d_inode) {
d_instantiate(direntry, inode); */ cifsInode = CIFS_I(old_file->d_inode);
/* BB add call to either mark inode dirty or refresh its data and timestamp to current time */ if(rc == 0) {
old_file->d_inode->i_nlink++;
old_file->d_inode->i_ctime = CURRENT_TIME;
/* parent dir timestamps will update from srv
within a second, would it really be worth it
to set the parent dir cifs inode time to zero
to force revalidate (faster) for it too? */
}
/* if not oplocked will force revalidate to get info
on source file from srv */
cifsInode->time = 0;
/* Will update parent dir timestamps from srv within a second.
Would it really be worth it to set the parent dir (cifs
inode) time field to zero to force revalidate on parent
directory faster ie
CIFS_I(inode)->time = 0; */
} }
d_drop(direntry); /* force new lookup from server */
cifsInode = CIFS_I(old_file->d_inode);
cifsInode->time = 0; /* will force revalidate to go get info when needed */
cifs_hl_exit: cifs_hl_exit:
kfree(fromName); kfree(fromName);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment