cifs: Avoid calling unlock_page() twice in cifs_readpage() when using fscache
authorSachin Prabhu <sprabhu@redhat.com>
Fri, 13 Sep 2013 13:11:57 +0000 (14:11 +0100)
committerSteve French <smfrench@gmail.com>
Fri, 13 Sep 2013 21:24:49 +0000 (16:24 -0500)
commit466bd31bbda9e1dd2ace1d72c8de5045bf6f3bf6
treea9f0d34082a17ed39a237dfb843441766c550a08
parenta9e9b7bc15a32ec5b0679704e70f3ffeecfaadd8
cifs: Avoid calling unlock_page() twice in cifs_readpage() when using fscache

When reading a single page with cifs_readpage(), we make a call to
fscache_read_or_alloc_page() which once done, asynchronously calls
the completion function cifs_readpage_from_fscache_complete(). This
completion function unlocks the page once it has been populated from
cache. The module then attempts to unlock the page a second time in
cifs_readpage() which leads to warning messages.

In case of a successful call to fscache_read_or_alloc_page() we should skip
the second unlock_page() since this will be called by the
cifs_readpage_from_fscache_complete() once the page has been populated by
fscache.

With the modifications to cifs_readpage_worker(), we will need to re-grab the
page lock in cifs_write_begin().

The problem was first noticed when testing new fscache patches for cifs.
https://bugzilla.redhat.com/show_bug.cgi?id=1005737

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/file.c