Fwd: [PATCH] CIFS: Use invalidate_inode_pages2 instead of invalidate_remote_inode (try #2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all!

I faced with a problem of data coherency in cifs and found out that
invalidate_remote_inode doesn't invalidate all pages in the failed
cases. I also find this comment
http://lxr.free-electrons.com/source/mm/truncate.c#L369 and decided
that the reason of such a strage behavior can be buddy page allocator,
that uses shrink_page_list(). So, what's why I decided to use
invalidate_inode_pages2 that deal with such pages successfully.

Could you comment on this patch? Is it a possible scenario that
invalidate_remote_inode can fail on pages if shrink_page_list() has a
temp ref on them?

2011/2/25 Pavel Shilovsky <piastry@xxxxxxxxxxx>:
> 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 on exclusive
> oplocks opens.
>
> Signed-off-by: Pavel Shilovsky <piastry@xxxxxxxxxxx>
> ---
>  fs/cifs/inode.c |   16 +++++++++++-----
>  1 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
> index 589f3e3..0011e95 100644
> --- a/fs/cifs/inode.c
> +++ b/fs/cifs/inode.c
> @@ -1687,12 +1687,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) {
> -               rc = filemap_write_and_wait(inode->i_mapping);
> -               mapping_set_error(inode->i_mapping, rc);
> +       if (inode->i_mapping) {
> +               /* write back any cached data */
> +               if (inode->i_mapping->nrpages != 0) {
> +                       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);
>        }
> -       invalidate_remote_inode(inode);
> +
>        cifs_fscache_reset_inode_cookie(inode);
>  }
>
> --
> 1.7.1
>
>



-- 
Best regards,
Pavel Shilovsky.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux