Skip to contentSkip to conversation

exofs: fix hang on error path

PATCH In review Idan Kedar 1 participant 2 messages Nov 25, 2012 – Nov 26, 2012 VFS

lore
Share & tools
lore

Idan Kedar

author
#0 lore raw

PATCH 1/1 exofs: fix hang on error path

if ore_write() fails, we would unlock the pages of pcol, which is now empty, rather than pcol_copy which owns the pages when ore_write() is called. this means that no pages will actually be unlocked (pcol.nr_pages == 0) and the writing process (more accurately, the syncing process) will hang waiting for a writeback notification that never comes.

---
 fs/exofs/inode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/exofs/inode.c +1 -1
index b561810..bc5f1fe 100644
@@ -676,7 +676,7 @@ static int write_exec(struct page_collect *pcol)
 	return 0;
 
 err:
-	_unlock_pcol_pages(pcol, ret, WRITE);
+	_unlock_pcol_pages(pcol->pages ? pcol : pcol_copy, ret, WRITE);
 	pcol_free(pcol);
 	kfree(pcol_copy);
 
Signature · 1 line
1.7.6.5
author
#1 lore raw
Quoted 17 lines · Idan Kedar

if ore_write() fails, we would unlock the pages of pcol, which is now empty, rather than pcol_copy which owns the pages when ore_write() is called. this means that no pages will actually be unlocked (pcol.nr_pages == 0) and the writing process (more accurately, the syncing process) will hang waiting for a writeback notification that never comes.

---
 fs/exofs/inode.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/exofs/inode.c +0 -0
index b561810..bc5f1fe 100644

fs/exofs/inode.c static int write_exec(struct page_collect *pcol) · line 680

Quoted 6 lines
fs/exofs/inode.c +1 -1
@@ -676,7 +676,7 @@ static int write_exec(struct page_collect *pcol)
        return 0;
 
 err:
-       _unlock_pcol_pages(pcol, ret, WRITE);
+       _unlock_pcol_pages(pcol->pages ? pcol : pcol_copy, ret, WRITE);
        pcol_free(pcol);

come think of it, pcol_free(pcol) will leak the ore_io_state here, i'm sending a new patch to fix that as well.

Quoted 5 lines
fs/exofs/inode.c +0 -1
        kfree(pcol_copy);
 
--

1.7.6.5

Signature · 1 line
idank