Skip to contentSkip to conversation

io context: fix ref counting

PATCH In review Li Zefan 3 participants 3 messages Jul 31, 2009

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 io context: fix ref counting

Commit d9c7d394a8ebacb60097b192939ae9f15235225e
("block: prevent possible io_context->refcount overflow") mistakenly changed atomic_inc(&ioc->nr_tasks) to atomic_long_inc(&ioc->refcount).

---
 include/linux/iocontext.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/iocontext.h +1 -1
index dd05434..4da4a75 100644
@@ -92,7 +92,7 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
 	 * a race).
 	 */
 	if (ioc && atomic_long_inc_not_zero(&ioc->refcount)) {
-		atomic_long_inc(&ioc->refcount);
+		atomic_inc(&ioc->nr_tasks);
 		return ioc;
 	}
 
Signature · 1 line
1.6.3
#2 lore raw
In reply to Li Zefan
Quoted 14 lines · Li Zefan

Commit d9c7d394a8ebacb60097b192939ae9f15235225e
("block: prevent possible io_context->refcount overflow") mistakenly changed atomic_inc(&ioc->nr_tasks) to atomic_long_inc(&ioc->refcount).

---
 include/linux/iocontext.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/iocontext.h +0 -0
index dd05434..4da4a75 100644

include/linux/iocontext.h static inline struct io_context *ioc_task_link(struct io_context *ioc) · line 97

Quoted 7 lines
include/linux/iocontext.h +1 -1
@@ -92,7 +92,7 @@ static inline struct io_context *ioc_task_link(struct io_context *ioc)
 	 * a race).
 	 */
 	if (ioc && atomic_long_inc_not_zero(&ioc->refcount)) {
-		atomic_long_inc(&ioc->refcount);
+		atomic_inc(&ioc->nr_tasks);
 		return ioc;
 	}

Irk, good catch. Applied to immediate upstream branch.

Signature · 1 line
Jens Axboe