Skip to content

Commit

Permalink
[CIFS] lseek polling returned stale EOF
Browse files Browse the repository at this point in the history
Fixes Samba bug 4362

Discovered by Jeremy Allison

Clipper database polls on EOF via lseek and can get stale EOF
when file is open on different client

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
  • Loading branch information
Steve French committed Feb 1, 2007
1 parent 190ff5b commit 030e9d8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,15 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
{
/* origin == SEEK_END => we must revalidate the cached file length */
if (origin == SEEK_END) {
int retval = cifs_revalidate(file->f_path.dentry);
int retval;

/* some applications poll for the file length in this strange
way so we must seek to end on non-oplocked files by
setting the revalidate time to zero */
if(file->f_path.dentry->d_inode)
CIFS_I(file->f_path.dentry->d_inode)->time = 0;

retval = cifs_revalidate(file->f_path.dentry);
if (retval < 0)
return (loff_t)retval;
}
Expand Down

0 comments on commit 030e9d8

Please sign in to comment.