exofs: fix hang on error path
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
@@ -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
Quoted 17 lines · Idan Kedar
if
ore_write()fails, we would unlock the pages of pcol, which is now empty, rather thanpcol_copywhich owns the pages whenore_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.Signed-off-by Idan Kedar <[email protected]>--- fs/exofs/inode.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)fs/exofs/inode.c +0
-0
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
-1kfree (pcol_copy); --1.7.6.5
Signature · 1 line
idank