From: David Howells Prevent cachefiles_write_page() from issuing an error twice, instead forgoing the callback if it can return the error directly. Previously, the netfs was being informed of the error twice, once by the error being passed to the netfs callback, and a second time when fscache_write_page() returned to the netfs. In NFS's case, this meant it attempted to do error handling twice, including clearing PG_fs_misc twice... Signed-off-by: David Howells Signed-off-by: Andrew Morton --- fs/cachefiles/cf-interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff -puN fs/cachefiles/cf-interface.c~fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-cachefiles-cachefiles_write_page-shouldnt-indicate-error-twice fs/cachefiles/cf-interface.c --- a/fs/cachefiles/cf-interface.c~fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-cachefiles-cachefiles_write_page-shouldnt-indicate-error-twice +++ a/fs/cachefiles/cf-interface.c @@ -1247,9 +1247,11 @@ static int cachefiles_write_page(struct "write page to backing file" " failed"); ret = -ENOBUFS; + } else { + /* only invoke the callback if successful, we return the error + * directly otherwise */ + end_io_func(page, context, ret); } - - end_io_func(page, context, ret); #endif _leave(" = %d", ret); _