diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-30 11:13:15 +0300 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-30 11:13:15 +0300 |
| commit | c88b94a9f43cecdeae4fa3d30cadd9a3f604372f (patch) | |
| tree | 113aea97fed1f08e0b5c9603c43fe1e147b68474 /fs/cachefiles/rdwr.c | |
| parent | 38c6aa2175c35358d01c29266000d26c78af9e36 (diff) | |
| parent | acb1872577b346bd15ab3a3f8dff780d6cca4b70 (diff) | |
| download | linux-c88b94a9f43cecdeae4fa3d30cadd9a3f604372f.tar.xz | |
Merge 4.18-rc7 into staging-next
We want the staging changes in here for testing and merge issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/cachefiles/rdwr.c')
| -rw-r--r-- | fs/cachefiles/rdwr.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 5082c8a49686..40f7595aad10 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c @@ -27,6 +27,7 @@ static int cachefiles_read_waiter(wait_queue_entry_t *wait, unsigned mode, struct cachefiles_one_read *monitor = container_of(wait, struct cachefiles_one_read, monitor); struct cachefiles_object *object; + struct fscache_retrieval *op = monitor->op; struct wait_bit_key *key = _key; struct page *page = wait->private; @@ -51,16 +52,22 @@ static int cachefiles_read_waiter(wait_queue_entry_t *wait, unsigned mode, list_del(&wait->entry); /* move onto the action list and queue for FS-Cache thread pool */ - ASSERT(monitor->op); + ASSERT(op); - object = container_of(monitor->op->op.object, - struct cachefiles_object, fscache); + /* We need to temporarily bump the usage count as we don't own a ref + * here otherwise cachefiles_read_copier() may free the op between the + * monitor being enqueued on the op->to_do list and the op getting + * enqueued on the work queue. + */ + fscache_get_retrieval(op); + object = container_of(op->op.object, struct cachefiles_object, fscache); spin_lock(&object->work_lock); - list_add_tail(&monitor->op_link, &monitor->op->to_do); + list_add_tail(&monitor->op_link, &op->to_do); spin_unlock(&object->work_lock); - fscache_enqueue_retrieval(monitor->op); + fscache_enqueue_retrieval(op); + fscache_put_retrieval(op); return 0; } |
