Skip to content

Commit

Permalink
logfs: fix "Kernel BUG at readwrite.c:1193"
Browse files Browse the repository at this point in the history
This happens when __logfs_create() tries to write a new inode to the disk
which is full.

__logfs_create() associates the transaction pointer with inode.  During
the logfs_write_inode() function call chain this transaction pointer is
moved from inode to page->private using function move_inode_to_page
(do_write_inode() -> inode_to_page() -> move_inode_to_page)

When the write inode fails, the transaction is aborted and iput is called
on the failed inode.  During delete_inode the same transaction pointer
associated with the page is getting used.  Thus causing kernel BUG.

The patch checks for error in write_inode() and restores the page->private
to NULL.

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=20162

Signed-off-by: Prasad Joshi <[email protected]>
Cc: Joern Engel <[email protected]>
Cc: Florian Mickler <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Maciej Rutecki <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Prasad Joshi authored and torvalds committed Dec 23, 2010
1 parent eabb26c commit f06328d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/logfs/readwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -1994,6 +1994,9 @@ static int do_write_inode(struct inode *inode)

/* FIXME: transaction is part of logfs_block now. Is that enough? */
err = logfs_write_buf(master_inode, page, 0);
if (err)
move_page_to_inode(inode, page);

logfs_put_write_page(page);
return err;
}
Expand Down

0 comments on commit f06328d

Please sign in to comment.