Skip to contentSkip to conversation

CacheFiles: cachefiles_write_page() shouldn't indicate error twice

PATCH New David Howells 1 participant 1 message Aug 31, 2006 Cachefiles: fs-cache backend for caching on mounted filesystems

lore
Share & tools
lore

David Howells

author maintainer
#0 lore raw

PATCH 1/1 CacheFiles: cachefiles_write_page() shouldn't indicate error twice

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...

---

 fs/cachefiles/cf-interface.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
fs/cachefiles/cf-interface.c +4 -2
index 6be3d98..4c0eb31 100644
@@ -1247,9 +1247,11 @@ #else
 						"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);