<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/logfs/readwrite.c, branch v3.4.19</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/fs/logfs/readwrite.c?h=v3.4.19</id>
<link rel='self' href='https://git.amat.us/linux/atom/fs/logfs/readwrite.c?h=v3.4.19'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-03-20T13:48:24Z</updated>
<entry>
<title>logfs: remove the second argument of k[un]map_atomic()</title>
<updated>2012-03-20T13:48:24Z</updated>
<author>
<name>Cong Wang</name>
<email>amwang@redhat.com</email>
</author>
<published>2011-11-25T15:14:31Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=50bc9b65b6e32f146c3c9812a9d62fe7ff518b5a'/>
<id>urn:sha1:50bc9b65b6e32f146c3c9812a9d62fe7ff518b5a</id>
<content type='text'>
Signed-off-by: Cong Wang &lt;amwang@redhat.com&gt;
</content>
</entry>
<entry>
<title>logfs: Grow inode in delete path</title>
<updated>2012-01-28T06:13:07Z</updated>
<author>
<name>Joern Engel</name>
<email>joern@logfs.org</email>
</author>
<published>2011-08-05T09:13:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=bbe01387129f76fa4bec17904eb14c4bdc3c179f'/>
<id>urn:sha1:bbe01387129f76fa4bec17904eb14c4bdc3c179f</id>
<content type='text'>
Can be necessary if an inode gets deleted (through -ENOSPC) before being
written.  Might be better to move this into logfs_write_rec(), but for
now go with the stupid&amp;safe patch.

Signed-off-by: Joern Engel &lt;joern@logfs.org&gt;
</content>
</entry>
<entry>
<title>logfs: Propagate page parameter to __logfs_write_inode</title>
<updated>2012-01-28T06:08:25Z</updated>
<author>
<name>Prasad Joshi</name>
<email>prasadjoshi.linux@gmail.com</email>
</author>
<published>2011-10-02T18:16:51Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=0bd90387ed5a8abbcf43391b480efdc211721cfe'/>
<id>urn:sha1:0bd90387ed5a8abbcf43391b480efdc211721cfe</id>
<content type='text'>
During GC LogFS has to rewrite each valid block to a separate segment.
Rewrite operation reads data from an old segment and writes it to a
newly allocated segment. Since every write operation changes data
block pointers maintained in inode, inode should also be rewritten.

In GC path to avoid AB-BA deadlock LogFS marks a page with
PG_pre_locked in addition to locking the page (PG_locked). The page
lock is ignored iff the page is pre-locked.

LogFS uses a special file called segment file. The segment file
maintains an 8 bytes entry for every segment. It keeps track of erase
count, level etc. for every segment.

Bad things happen with a segment belonging to the segment file is GCed

 ------------[ cut here ]------------
kernel BUG at /home/prasad/logfs/readwrite.c:297!
invalid opcode: 0000 [#1] SMP
Modules linked in: logfs joydev usbhid hid psmouse e1000 i2c_piix4
		serio_raw [last unloaded: logfs]
Pid: 20161, comm: mount Not tainted 3.1.0-rc3+ #3 innotek GmbH
		VirtualBox
EIP: 0060:[&lt;f809132a&gt;] EFLAGS: 00010292 CPU: 0
EIP is at logfs_lock_write_page+0x6a/0x70 [logfs]
EAX: 00000027 EBX: f73f5b20 ECX: c16007c8 EDX: 00000094
ESI: 00000000 EDI: e59be6e4 EBP: c7337b28 ESP: c7337b18
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
Process mount (pid: 20161, ti=c7336000 task=eb323f70 task.ti=c7336000)
Stack:
f8099a3d c7337b24 f73f5b20 00001002 c7337b50 f8091f6d f8099a4d f80994e4
00000003 00000000 c7337b68 00000000 c67e4400 00001000 c7337b80 f80935e5
00000000 00000000 00000000 00000000 e1fcf000 0000000f e59be618 c70bf900
Call Trace:
[&lt;f8091f6d&gt;] logfs_get_write_page.clone.16+0xdd/0x100 [logfs]
[&lt;f80935e5&gt;] logfs_mod_segment_entry+0x55/0x110 [logfs]
[&lt;f809460d&gt;] logfs_get_segment_entry+0x1d/0x20 [logfs]
[&lt;f8091060&gt;] ? logfs_cleanup_journal+0x50/0x50 [logfs]
[&lt;f809521b&gt;] ostore_get_erase_count+0x1b/0x40 [logfs]
[&lt;f80965b8&gt;] logfs_open_area+0xc8/0x150 [logfs]
[&lt;c141a7ec&gt;] ? kmemleak_alloc+0x2c/0x60
[&lt;f809668e&gt;] __logfs_segment_write.clone.16+0x4e/0x1b0 [logfs]
[&lt;c10dd563&gt;] ? mempool_kmalloc+0x13/0x20
[&lt;c10dd563&gt;] ? mempool_kmalloc+0x13/0x20
[&lt;f809696f&gt;] logfs_segment_write+0x17f/0x1d0 [logfs]
[&lt;f8092e8c&gt;] logfs_write_i0+0x11c/0x180 [logfs]
[&lt;f8092f35&gt;] logfs_write_direct+0x45/0x90 [logfs]
[&lt;f80934cd&gt;] __logfs_write_buf+0xbd/0xf0 [logfs]
[&lt;c102900e&gt;] ? kmap_atomic_prot+0x4e/0xe0
[&lt;f809424b&gt;] logfs_write_buf+0x3b/0x60 [logfs]
[&lt;f80947a9&gt;] __logfs_write_inode+0xa9/0x110 [logfs]
[&lt;f8094cb0&gt;] logfs_rewrite_block+0xc0/0x110 [logfs]
[&lt;f8095300&gt;] ? get_mapping_page+0x10/0x60 [logfs]
[&lt;f8095aa0&gt;] ? logfs_load_object_aliases+0x2e0/0x2f0 [logfs]
[&lt;f808e57d&gt;] logfs_gc_segment+0x2ad/0x310 [logfs]
[&lt;f808e62a&gt;] __logfs_gc_once+0x4a/0x80 [logfs]
[&lt;f808ed43&gt;] logfs_gc_pass+0x683/0x6a0 [logfs]
[&lt;f8097a89&gt;] logfs_mount+0x5a9/0x680 [logfs]
[&lt;c1126b21&gt;] mount_fs+0x21/0xd0
[&lt;c10f6f6f&gt;] ? __alloc_percpu+0xf/0x20
[&lt;c113da41&gt;] ? alloc_vfsmnt+0xb1/0x130
[&lt;c113db4b&gt;] vfs_kern_mount+0x4b/0xa0
[&lt;c113e06e&gt;] do_kern_mount+0x3e/0xe0
[&lt;c113f60d&gt;] do_mount+0x34d/0x670
[&lt;c10f2749&gt;] ? strndup_user+0x49/0x70
[&lt;c113fcab&gt;] sys_mount+0x6b/0xa0
[&lt;c142d87c&gt;] syscall_call+0x7/0xb
Code: f8 e8 8b 93 39 c9 8b 45 f8 3e 0f ba 28 00 19 d2 85 d2 74 ca eb d0 0f 0b 8d 45 fc 89 44 24 04 c7 04 24 3d 9a 09 f8 e8 09 92 39 c9 &lt;0f&gt; 0b 8d 74 26 00 55 89 e5 3e 8d 74 26 00 8b 10 80 e6 01 74 09
EIP: [&lt;f809132a&gt;] logfs_lock_write_page+0x6a/0x70 [logfs] SS:ESP 0068:c7337b18
---[ end trace 96e67d5b3aa3d6ca ]---

The patch passes locked page to __logfs_write_inode. It calls function
logfs_get_wblocks() to pre-lock the page. This ensures any further
attempts to lock the page are ignored (esp from get_erase_count).

Acked-by: Joern Engel &lt;joern@logfs.org&gt;
Signed-off-by: Prasad Joshi &lt;prasadjoshi.linux@gmail.com&gt;
</content>
</entry>
<entry>
<title>logfs: take write mutex lock during fsync and sync</title>
<updated>2012-01-28T06:06:06Z</updated>
<author>
<name>Prasad Joshi</name>
<email>prasadjoshi.linux@gmail.com</email>
</author>
<published>2012-01-28T06:06:06Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=13ced29cb28996a9bc4f68e43ff0c57eafdb1e21'/>
<id>urn:sha1:13ced29cb28996a9bc4f68e43ff0c57eafdb1e21</id>
<content type='text'>
LogFS uses super-&gt;s_write_mutex while writing data to disk. Taking the
same mutex lock in sync and fsync code path solves the following BUG:

------------[ cut here ]------------
kernel BUG at /home/prasad/logfs/dev_bdev.c:134!

Pid: 2387, comm: flush-253:16 Not tainted 3.0.0+ #4 Bochs Bochs
RIP: 0010:[&lt;ffffffffa007deed&gt;]  [&lt;ffffffffa007deed&gt;]
                bdev_writeseg+0x25d/0x270 [logfs]
Call Trace:
[&lt;ffffffffa007c381&gt;] logfs_open_area+0x91/0x150 [logfs]
[&lt;ffffffff8128dcb2&gt;] ? find_level.clone.9+0x62/0x100
[&lt;ffffffffa007c49c&gt;] __logfs_segment_write.clone.20+0x5c/0x190 [logfs]
[&lt;ffffffff810ef005&gt;] ? mempool_kmalloc+0x15/0x20
[&lt;ffffffff810ef383&gt;] ? mempool_alloc+0x53/0x130
[&lt;ffffffffa007c7a4&gt;] logfs_segment_write+0x1d4/0x230 [logfs]
[&lt;ffffffffa0078f8e&gt;] logfs_write_i0+0x12e/0x190 [logfs]
[&lt;ffffffffa0079300&gt;] __logfs_write_rec+0x140/0x220 [logfs]
[&lt;ffffffffa0079444&gt;] logfs_write_rec+0x64/0xd0 [logfs]
[&lt;ffffffffa00795b6&gt;] __logfs_write_buf+0x106/0x110 [logfs]
[&lt;ffffffffa007a13e&gt;] logfs_write_buf+0x4e/0x80 [logfs]
[&lt;ffffffffa0073e33&gt;] __logfs_writepage+0x23/0x80 [logfs]
[&lt;ffffffffa007410c&gt;] logfs_writepage+0xdc/0x110 [logfs]
[&lt;ffffffff810f5ba7&gt;] __writepage+0x17/0x40
[&lt;ffffffff810f6208&gt;] write_cache_pages+0x208/0x4f0
[&lt;ffffffff810f5b90&gt;] ? set_page_dirty+0x70/0x70
[&lt;ffffffff810f653a&gt;] generic_writepages+0x4a/0x70
[&lt;ffffffff810f75d1&gt;] do_writepages+0x21/0x40
[&lt;ffffffff8116b9d1&gt;] writeback_single_inode+0x101/0x250
[&lt;ffffffff8116bdbd&gt;] writeback_sb_inodes+0xed/0x1c0
[&lt;ffffffff8116c5fb&gt;] writeback_inodes_wb+0x7b/0x1e0
[&lt;ffffffff8116cc23&gt;] wb_writeback+0x4c3/0x530
[&lt;ffffffff814d984d&gt;] ? sub_preempt_count+0x9d/0xd0
[&lt;ffffffff8116cd6b&gt;] wb_do_writeback+0xdb/0x290
[&lt;ffffffff814d984d&gt;] ? sub_preempt_count+0x9d/0xd0
[&lt;ffffffff814d6208&gt;] ? _raw_spin_unlock_irqrestore+0x18/0x40
[&lt;ffffffff8105aa5a&gt;] ? del_timer+0x8a/0x120
[&lt;ffffffff8116cfac&gt;] bdi_writeback_thread+0x8c/0x2e0
[&lt;ffffffff8116cf20&gt;] ? wb_do_writeback+0x290/0x290
[&lt;ffffffff8106d2e6&gt;] kthread+0x96/0xa0
[&lt;ffffffff814de514&gt;] kernel_thread_helper+0x4/0x10
[&lt;ffffffff8106d250&gt;] ? kthread_worker_fn+0x190/0x190
[&lt;ffffffff814de510&gt;] ? gs_change+0xb/0xb
RIP  [&lt;ffffffffa007deed&gt;] bdev_writeseg+0x25d/0x270 [logfs]
---[ end trace 0211ad60a57657c4 ]---

Reviewed-by: Joern Engel &lt;joern@logfs.org&gt;
Signed-off-by: Prasad Joshi &lt;prasadjoshi.linux@gmail.com&gt;
</content>
</entry>
<entry>
<title>logfs: update page reference count for pined pages</title>
<updated>2012-01-28T05:53:10Z</updated>
<author>
<name>Prasad Joshi</name>
<email>prasadjoshi.linux@gmail.com</email>
</author>
<published>2011-11-26T05:30:47Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=96150606e2fb82d242c9e4a414e4e922849f7bf7'/>
<id>urn:sha1:96150606e2fb82d242c9e4a414e4e922849f7bf7</id>
<content type='text'>
LogFS sets PG_private flag to indicate a pined page. We assumed that
marking a page as private is enough to ensure its existence. But
instead it is necessary to hold a reference count to the page.

The change resolves the following BUG

BUG: Bad page state in process flush-253:16  pfn:6a6d0
page flags: 0x100000000000808(uptodate|private)

Suggested-and-Acked-by: Joern Engel &lt;joern@logfs.org&gt;
Signed-off-by: Prasad Joshi &lt;prasadjoshi.linux@gmail.com&gt;
</content>
</entry>
<entry>
<title>filesystems: add set_nlink()</title>
<updated>2011-11-02T11:53:43Z</updated>
<author>
<name>Miklos Szeredi</name>
<email>mszeredi@suse.cz</email>
</author>
<published>2011-10-28T12:13:29Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=bfe8684869601dacfcb2cd69ef8cfd9045f62170'/>
<id>urn:sha1:bfe8684869601dacfcb2cd69ef8cfd9045f62170</id>
<content type='text'>
Replace remaining direct i_nlink updates with a new set_nlink()
updater function.

Signed-off-by: Miklos Szeredi &lt;mszeredi@suse.cz&gt;
Tested-by: Toshiyuki Okajima &lt;toshi.okajima@jp.fujitsu.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
</content>
</entry>
<entry>
<title>Merge branch 'master' into for-next</title>
<updated>2011-04-26T08:22:59Z</updated>
<author>
<name>Jiri Kosina</name>
<email>jkosina@suse.cz</email>
</author>
<published>2011-04-26T08:22:15Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=07f9479a40cc778bc1462ada11f95b01360ae4ff'/>
<id>urn:sha1:07f9479a40cc778bc1462ada11f95b01360ae4ff</id>
<content type='text'>
Fast-forwarded to current state of Linus' tree as there are patches to be
applied for files that didn't exist on the old branch.
</content>
</entry>
<entry>
<title>treewide: remove extra semicolons</title>
<updated>2011-04-10T15:01:05Z</updated>
<author>
<name>Justin P. Mattock</name>
<email>justinmattock@gmail.com</email>
</author>
<published>2011-04-09T02:49:08Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=6eab04a87677a37cf15b52e2b4b4fd57917102ad'/>
<id>urn:sha1:6eab04a87677a37cf15b52e2b4b4fd57917102ad</id>
<content type='text'>
Signed-off-by: Justin P. Mattock &lt;justinmattock@gmail.com&gt;
Signed-off-by: Jiri Kosina &lt;jkosina@suse.cz&gt;
</content>
</entry>
<entry>
<title>Fix common misspellings</title>
<updated>2011-03-31T14:26:23Z</updated>
<author>
<name>Lucas De Marchi</name>
<email>lucas.demarchi@profusion.mobi</email>
</author>
<published>2011-03-31T01:57:33Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=25985edcedea6396277003854657b5f3cb31a628'/>
<id>urn:sha1:25985edcedea6396277003854657b5f3cb31a628</id>
<content type='text'>
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi &lt;lucas.demarchi@profusion.mobi&gt;
</content>
</entry>
<entry>
<title>logfs: fix "Kernel BUG at readwrite.c:1193"</title>
<updated>2010-12-23T03:43:33Z</updated>
<author>
<name>Prasad Joshi</name>
<email>prasadjoshi124@gmail.com</email>
</author>
<published>2010-12-22T01:24:20Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f06328d7721ad3852c45eb2a10a0c8f9439b5f33'/>
<id>urn:sha1:f06328d7721ad3852c45eb2a10a0c8f9439b5f33</id>
<content type='text'>
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-&gt;private using function move_inode_to_page
(do_write_inode() -&gt; inode_to_page() -&gt; 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-&gt;private
to NULL.

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

Signed-off-by: Prasad Joshi &lt;prasadjoshi124@gmail.com&gt;
Cc: Joern Engel &lt;joern@logfs.org&gt;
Cc: Florian Mickler &lt;florian@mickler.org&gt;
Cc: "Rafael J. Wysocki" &lt;rjw@sisk.pl&gt;
Cc: Maciej Rutecki &lt;maciej.rutecki@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
