Skip to content

Commit

Permalink
CIFS: Use invalidate_inode_pages2 instead of invalidate_remote_inode …
Browse files Browse the repository at this point in the history
…(try #4)

Use invalidate_inode_pages2 that don't leave pages even if shrink_page_list()
has a temp ref on them. It prevents a data coherency problem when
cifs_invalidate_mapping didn't invalidate pages but the client thinks that a data
from the cache is uptodate according to an oplock level (exclusive or II).

Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Steve French <sfrench@us.ibm.com>
  • Loading branch information
piastry authored and Steve French committed May 19, 2011
1 parent fd5707e commit 257fb1f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions fs/cifs/inode.c
Expand Up @@ -1691,12 +1691,18 @@ cifs_invalidate_mapping(struct inode *inode)

cifs_i->invalid_mapping = false;

/* write back any cached data */
if (inode->i_mapping && inode->i_mapping->nrpages != 0) {
/* write back any cached data */
rc = filemap_write_and_wait(inode->i_mapping);
mapping_set_error(inode->i_mapping, rc);
rc = invalidate_inode_pages2(inode->i_mapping);
if (rc) {
cERROR(1, "%s: could not invalidate inode %p", __func__,
inode);
cifs_i->invalid_mapping = true;
}
}
invalidate_remote_inode(inode);

cifs_fscache_reset_inode_cookie(inode);
}

Expand Down

0 comments on commit 257fb1f

Please sign in to comment.