]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/linux/fscache-cache.h
UBUNTU: SAUCE: fscache: Fix race in decrementing refcount of op->npages
[mirror_ubuntu-bionic-kernel.git] / include / linux / fscache-cache.h
index 4c467ef50159db533ecb567a86eeaf6e1e81e632..91be23fa037c0cc8432a698a401f0d6ae0e6565e 100644 (file)
@@ -183,8 +183,7 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op)
 static inline void fscache_retrieval_complete(struct fscache_retrieval *op,
                                              int n_pages)
 {
-       atomic_sub(n_pages, &op->n_pages);
-       if (atomic_read(&op->n_pages) <= 0)
+       if (atomic_sub_return(n_pages, &op->n_pages) <= 0)
                fscache_op_complete(&op->op, true);
 }