diff options
| -rw-r--r-- | fs/cachefiles/namei.c | 8 | ||||
| -rw-r--r-- | fs/cachefiles/rdwr.c | 9 | ||||
| -rw-r--r-- | fs/cachefiles/xattr.c | 3 | ||||
| -rw-r--r-- | fs/fscache/object.c | 3 | ||||
| -rw-r--r-- | include/linux/fscache-cache.h | 3 |
5 files changed, 17 insertions, 9 deletions
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 95983c744164..1645fcfd9691 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
| @@ -244,11 +244,13 @@ wait_for_old_object: | |||
| 244 | 244 | ||
| 245 | ASSERT(!test_bit(CACHEFILES_OBJECT_ACTIVE, &xobject->flags)); | 245 | ASSERT(!test_bit(CACHEFILES_OBJECT_ACTIVE, &xobject->flags)); |
| 246 | 246 | ||
| 247 | cache->cache.ops->put_object(&xobject->fscache, cachefiles_obj_put_wait_retry); | 247 | cache->cache.ops->put_object(&xobject->fscache, |
| 248 | (enum fscache_obj_ref_trace)cachefiles_obj_put_wait_retry); | ||
| 248 | goto try_again; | 249 | goto try_again; |
| 249 | 250 | ||
| 250 | requeue: | 251 | requeue: |
| 251 | cache->cache.ops->put_object(&xobject->fscache, cachefiles_obj_put_wait_timeo); | 252 | cache->cache.ops->put_object(&xobject->fscache, |
| 253 | (enum fscache_obj_ref_trace)cachefiles_obj_put_wait_timeo); | ||
| 252 | _leave(" = -ETIMEDOUT"); | 254 | _leave(" = -ETIMEDOUT"); |
| 253 | return -ETIMEDOUT; | 255 | return -ETIMEDOUT; |
| 254 | } | 256 | } |
| @@ -336,7 +338,7 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache, | |||
| 336 | try_again: | 338 | try_again: |
| 337 | /* first step is to make up a grave dentry in the graveyard */ | 339 | /* first step is to make up a grave dentry in the graveyard */ |
| 338 | sprintf(nbuffer, "%08x%08x", | 340 | sprintf(nbuffer, "%08x%08x", |
| 339 | (uint32_t) get_seconds(), | 341 | (uint32_t) ktime_get_real_seconds(), |
| 340 | (uint32_t) atomic_inc_return(&cache->gravecounter)); | 342 | (uint32_t) atomic_inc_return(&cache->gravecounter)); |
| 341 | 343 | ||
| 342 | /* do the multiway lock magic */ | 344 | /* do the multiway lock magic */ |
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 40f7595aad10..8a577409d030 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
| @@ -535,7 +535,10 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
| 535 | netpage->index, cachefiles_gfp); | 535 | netpage->index, cachefiles_gfp); |
| 536 | if (ret < 0) { | 536 | if (ret < 0) { |
| 537 | if (ret == -EEXIST) { | 537 | if (ret == -EEXIST) { |
| 538 | put_page(backpage); | ||
| 539 | backpage = NULL; | ||
| 538 | put_page(netpage); | 540 | put_page(netpage); |
| 541 | netpage = NULL; | ||
| 539 | fscache_retrieval_complete(op, 1); | 542 | fscache_retrieval_complete(op, 1); |
| 540 | continue; | 543 | continue; |
| 541 | } | 544 | } |
| @@ -608,7 +611,10 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, | |||
| 608 | netpage->index, cachefiles_gfp); | 611 | netpage->index, cachefiles_gfp); |
| 609 | if (ret < 0) { | 612 | if (ret < 0) { |
| 610 | if (ret == -EEXIST) { | 613 | if (ret == -EEXIST) { |
| 614 | put_page(backpage); | ||
| 615 | backpage = NULL; | ||
| 611 | put_page(netpage); | 616 | put_page(netpage); |
| 617 | netpage = NULL; | ||
| 612 | fscache_retrieval_complete(op, 1); | 618 | fscache_retrieval_complete(op, 1); |
| 613 | continue; | 619 | continue; |
| 614 | } | 620 | } |
| @@ -962,11 +968,8 @@ void cachefiles_uncache_page(struct fscache_object *_object, struct page *page) | |||
| 962 | __releases(&object->fscache.cookie->lock) | 968 | __releases(&object->fscache.cookie->lock) |
| 963 | { | 969 | { |
| 964 | struct cachefiles_object *object; | 970 | struct cachefiles_object *object; |
| 965 | struct cachefiles_cache *cache; | ||
| 966 | 971 | ||
| 967 | object = container_of(_object, struct cachefiles_object, fscache); | 972 | object = container_of(_object, struct cachefiles_object, fscache); |
| 968 | cache = container_of(object->fscache.cache, | ||
| 969 | struct cachefiles_cache, cache); | ||
| 970 | 973 | ||
| 971 | _enter("%p,{%lu}", object, page->index); | 974 | _enter("%p,{%lu}", object, page->index); |
| 972 | 975 | ||
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c index 0a29a00aed2e..511e6c68156a 100644 --- a/fs/cachefiles/xattr.c +++ b/fs/cachefiles/xattr.c | |||
| @@ -135,7 +135,8 @@ int cachefiles_update_object_xattr(struct cachefiles_object *object, | |||
| 135 | struct dentry *dentry = object->dentry; | 135 | struct dentry *dentry = object->dentry; |
| 136 | int ret; | 136 | int ret; |
| 137 | 137 | ||
| 138 | ASSERT(dentry); | 138 | if (!dentry) |
| 139 | return -ESTALE; | ||
| 139 | 140 | ||
| 140 | _enter("%p,#%d", object, auxdata->len); | 141 | _enter("%p,#%d", object, auxdata->len); |
| 141 | 142 | ||
diff --git a/fs/fscache/object.c b/fs/fscache/object.c index 9edc920f651f..6d9cb1719de5 100644 --- a/fs/fscache/object.c +++ b/fs/fscache/object.c | |||
| @@ -730,6 +730,9 @@ static const struct fscache_state *fscache_drop_object(struct fscache_object *ob | |||
| 730 | 730 | ||
| 731 | if (awaken) | 731 | if (awaken) |
| 732 | wake_up_bit(&cookie->flags, FSCACHE_COOKIE_INVALIDATING); | 732 | wake_up_bit(&cookie->flags, FSCACHE_COOKIE_INVALIDATING); |
| 733 | if (test_and_clear_bit(FSCACHE_COOKIE_LOOKING_UP, &cookie->flags)) | ||
| 734 | wake_up_bit(&cookie->flags, FSCACHE_COOKIE_LOOKING_UP); | ||
| 735 | |||
| 733 | 736 | ||
| 734 | /* Prevent a race with our last child, which has to signal EV_CLEARED | 737 | /* Prevent a race with our last child, which has to signal EV_CLEARED |
| 735 | * before dropping our spinlock. | 738 | * before dropping our spinlock. |
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h index 34cf0fdd7dc7..610815e3f1aa 100644 --- a/include/linux/fscache-cache.h +++ b/include/linux/fscache-cache.h | |||
| @@ -196,8 +196,7 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op) | |||
| 196 | static inline void fscache_retrieval_complete(struct fscache_retrieval *op, | 196 | static inline void fscache_retrieval_complete(struct fscache_retrieval *op, |
| 197 | int n_pages) | 197 | int n_pages) |
| 198 | { | 198 | { |
| 199 | atomic_sub(n_pages, &op->n_pages); | 199 | if (atomic_sub_return_relaxed(n_pages, &op->n_pages) <= 0) |
| 200 | if (atomic_read(&op->n_pages) <= 0) | ||
| 201 | fscache_op_complete(&op->op, false); | 200 | fscache_op_complete(&op->op, false); |
| 202 | } | 201 | } |
| 203 | 202 | ||
