Skip to content

Commit b27ddd4

Browse files
committed
fscache: Pass the correct cancelled indications to fscache_op_complete()
The last parameter to fscache_op_complete() is a bool indicating whether or not the operation was cancelled. A lot of the time the inverse value is given or no differentiation is made. Fix this. Signed-off-by: David Howells <[email protected]>
1 parent bfa3837 commit b27ddd4

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

fs/fscache/page.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,11 @@ static void fscache_attr_changed_op(struct fscache_operation *op)
185185
fscache_stat_d(&fscache_n_cop_attr_changed);
186186
if (ret < 0)
187187
fscache_abort_object(object);
188+
fscache_op_complete(op, ret < 0);
189+
} else {
190+
fscache_op_complete(op, true);
188191
}
189192

190-
fscache_op_complete(op, true);
191193
_leave("");
192194
}
193195

@@ -780,11 +782,12 @@ static void fscache_write_op(struct fscache_operation *_op)
780782
cookie = object->cookie;
781783

782784
if (!fscache_object_is_active(object)) {
783-
/* If we get here, then the on-disk cache object likely longer
784-
* exists, so we should just cancel this write operation.
785+
/* If we get here, then the on-disk cache object likely no
786+
* longer exists, so we should just cancel this write
787+
* operation.
785788
*/
786789
spin_unlock(&object->lock);
787-
fscache_op_complete(&op->op, false);
790+
fscache_op_complete(&op->op, true);
788791
_leave(" [inactive]");
789792
return;
790793
}
@@ -797,7 +800,7 @@ static void fscache_write_op(struct fscache_operation *_op)
797800
* cancel this write operation.
798801
*/
799802
spin_unlock(&object->lock);
800-
fscache_op_complete(&op->op, false);
803+
fscache_op_complete(&op->op, true);
801804
_leave(" [cancel] op{f=%lx s=%u} obj{s=%s f=%lx}",
802805
_op->flags, _op->state, object->state->short_name,
803806
object->flags);
@@ -851,7 +854,7 @@ static void fscache_write_op(struct fscache_operation *_op)
851854
spin_unlock(&cookie->stores_lock);
852855
clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags);
853856
spin_unlock(&object->lock);
854-
fscache_op_complete(&op->op, true);
857+
fscache_op_complete(&op->op, false);
855858
_leave("");
856859
}
857860

include/linux/fscache-cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static inline void fscache_retrieval_complete(struct fscache_retrieval *op,
185185
{
186186
atomic_sub(n_pages, &op->n_pages);
187187
if (atomic_read(&op->n_pages) <= 0)
188-
fscache_op_complete(&op->op, true);
188+
fscache_op_complete(&op->op, false);
189189
}
190190

191191
/**

0 commit comments

Comments
 (0)