aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fscache
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2009-11-19 13:11:11 -0500
committerDavid Howells <dhowells@redhat.com>2009-11-19 13:11:11 -0500
commit7e311a207d596b9273d811149d6e3e14f05ac4c0 (patch)
tree96c766e56e73df02a430bc0df72066413838fed0 /fs/fscache
parent52bd75fdb135d6133d878ae60c6e7e3f4ebc1cfc (diff)
FS-Cache: Clear netfs pointers in cookie after detaching object, not before
Clear the pointers from the fscache_cookie struct to netfs private data after clearing the pointer to the cookie from the fscache_object struct and releasing the object lock, rather than before. This allows the netfs private data pointers to be relied on simply by holding the object lock, rather than having to hold the cookie lock. This is makes things simpler as the cookie lock has to be taken before the object lock, but sometimes the object pointer is all that the code has. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/fscache')
-rw-r--r--fs/fscache/cookie.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c
index 432482edc738..b1870a6c2cd3 100644
--- a/fs/fscache/cookie.c
+++ b/fs/fscache/cookie.c
@@ -437,12 +437,8 @@ void __fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
437 437
438 event = retire ? FSCACHE_OBJECT_EV_RETIRE : FSCACHE_OBJECT_EV_RELEASE; 438 event = retire ? FSCACHE_OBJECT_EV_RETIRE : FSCACHE_OBJECT_EV_RELEASE;
439 439
440 /* detach pointers back to the netfs */
441 spin_lock(&cookie->lock); 440 spin_lock(&cookie->lock);
442 441
443 cookie->netfs_data = NULL;
444 cookie->def = NULL;
445
446 /* break links with all the active objects */ 442 /* break links with all the active objects */
447 while (!hlist_empty(&cookie->backing_objects)) { 443 while (!hlist_empty(&cookie->backing_objects)) {
448 object = hlist_entry(cookie->backing_objects.first, 444 object = hlist_entry(cookie->backing_objects.first,
@@ -465,6 +461,10 @@ void __fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
465 BUG(); 461 BUG();
466 } 462 }
467 463
464 /* detach pointers back to the netfs */
465 cookie->netfs_data = NULL;
466 cookie->def = NULL;
467
468 spin_unlock(&cookie->lock); 468 spin_unlock(&cookie->lock);
469 469
470 if (cookie->parent) { 470 if (cookie->parent) {