<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/ubifs, branch linux-3.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2014-11-14T18:10:23Z</updated>
<entry>
<title>UBIFS: fix free log space calculation</title>
<updated>2014-11-14T18:10:23Z</updated>
<author>
<name>Artem Bityutskiy</name>
</author>
<published>2014-07-16T12:22:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=602f5e766a649bd8cdae3dc169b848352a34b4d8'/>
<id>urn:sha1:602f5e766a649bd8cdae3dc169b848352a34b4d8</id>
<content type='text'>
commit ba29e721eb2df6df8f33c1f248388bb037a47914 upstream.

Hu (hujianyang &lt;hujianyang@huawei.com&gt;) discovered an issue in the
'empty_log_bytes()' function, which calculates how many bytes are left in the
log:

"
If 'c-&gt;lhead_lnum + 1 == c-&gt;ltail_lnum' and 'c-&gt;lhead_offs == c-&gt;leb_size', 'h'
would equalent to 't' and 'empty_log_bytes()' would return 'c-&gt;log_bytes'
instead of 0.
"

At this point it is not clear what would be the consequences of this, and
whether this may lead to any problems, but this patch addresses the issue just
in case.

Tested-by: hujianyang &lt;hujianyang@huawei.com&gt;
Reported-by: hujianyang &lt;hujianyang@huawei.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>UBIFS: fix a race condition</title>
<updated>2014-11-14T18:10:23Z</updated>
<author>
<name>Artem Bityutskiy</name>
</author>
<published>2014-06-29T14:00:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=558dcb66298d9fe3ab65d67e04e2ce142fc639f1'/>
<id>urn:sha1:558dcb66298d9fe3ab65d67e04e2ce142fc639f1</id>
<content type='text'>
commit 052c28073ff26f771d44ef33952a41d18dadd255 upstream.

Hu (hujianyang@huawei.com) discovered a race condition which may lead to a
situation when UBIFS is unable to mount the file-system after an unclean
reboot. The problem is theoretical, though.

In UBIFS, we have the log, which basically a set of LEBs in a certain area. The
log has the tail and the head.

Every time user writes data to the file-system, the UBIFS journal grows, and
the log grows as well, because we append new reference nodes to the head of the
log. So the head moves forward all the time, while the log tail stays at the
same position.

At any time, the UBIFS master node points to the tail of the log. When we mount
the file-system, we scan the log, and we always start from its tail, because
this is where the master node points to. The only occasion when the tail of the
log changes is the commit operation.

The commit operation has 2 phases - "commit start" and "commit end". The former
is relatively short, and does not involve much I/O. During this phase we mostly
just build various in-memory lists of the things which have to be written to
the flash media during "commit end" phase.

During the commit start phase, what we do is we "clean" the log. Indeed, the
commit operation will index all the data in the journal, so the entire journal
"disappears", and therefore the data in the log become unneeded. So we just
move the head of the log to the next LEB, and write the CS node there. This LEB
will be the tail of the new log when the commit operation finishes.

When the "commit start" phase finishes, users may write more data to the
file-system, in parallel with the ongoing "commit end" operation. At this point
the log tail was not changed yet, it is the same as it had been before we
started the commit. The log head keeps moving forward, though.

The commit operation now needs to write the new master node, and the new master
node should point to the new log tail. After this the LEBs between the old log
tail and the new log tail can be unmapped and re-used again.

And here is the possible problem. We do 2 operations: (a) We first update the
log tail position in memory (see 'ubifs_log_end_commit()'). (b) And then we
write the master node (see the big lock of code in 'do_commit()').

But nothing prevents the log head from moving forward between (a) and (b), and
the log head may "wrap" now to the old log tail. And when the "wrap" happens,
the contends of the log tail gets erased. Now a power cut happens and we are in
trouble. We end up with the old master node pointing to the old tail, which was
erased. And replay fails because it expects the master node to point to the
correct log tail at all times.

This patch merges the abovementioned (a) and (b) operations by moving the master
node change code to the 'ubifs_log_end_commit()' function, so that it runs with
the log mutex locked, which will prevent the log from being changed benween
operations (a) and (b).

Reported-by: hujianyang &lt;hujianyang@huawei.com&gt;
Tested-by: hujianyang &lt;hujianyang@huawei.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>UBIFS: Add log overlap assertions</title>
<updated>2014-07-31T12:52:51Z</updated>
<author>
<name>hujianyang</name>
</author>
<published>2014-07-30T02:37:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=25601a3c9737fed554169759582c690b98ead5d4'/>
<id>urn:sha1:25601a3c9737fed554169759582c690b98ead5d4</id>
<content type='text'>
We use a circle area to record the log nodes in ubifs. This log area
should not be overlapped. But after researching the code, I found
some conditions may lead log head wraps log ltail. Although we've
fixed the problems discovered, there may be some other issues still
left.

This patch adds assertions where lhead changes to next leb to make
sure ltail is not wrapped.

Signed-off-by: hujianyang &lt;hujianyang@huawei.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>Revert "UBIFS: add a log overlap assertion"</title>
<updated>2014-07-28T16:15:19Z</updated>
<author>
<name>Artem Bityutskiy</name>
</author>
<published>2014-07-28T16:14:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6390e991776ec2519b4505d48dd82b0e88d359d2'/>
<id>urn:sha1:6390e991776ec2519b4505d48dd82b0e88d359d2</id>
<content type='text'>
This reverts commit 545f7fdf6db866c26ac92346b35bc6489fb926d1.

Hujianyang's testing revealed that the patch is bogus.

Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBIFS: add a log overlap assertion</title>
<updated>2014-07-19T06:55:19Z</updated>
<author>
<name>Artem Bityutskiy</name>
</author>
<published>2014-07-16T12:29:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=545f7fdf6db866c26ac92346b35bc6489fb926d1'/>
<id>urn:sha1:545f7fdf6db866c26ac92346b35bc6489fb926d1</id>
<content type='text'>
Add an assertion which checkes that the head of the log never overlaps with the
tail of the log.

Suggested-by: hujianyang &lt;hujianyang@huawei.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBIFS: remove unnecessary check</title>
<updated>2014-07-19T06:54:25Z</updated>
<author>
<name>Artem Bityutskiy</name>
</author>
<published>2014-06-29T14:22:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f1cb705accc70ac327de2108ecf07b300e03fc42'/>
<id>urn:sha1:f1cb705accc70ac327de2108ecf07b300e03fc42</id>
<content type='text'>
Remove the "if (c-&gt;lhead_offs == 0)" check because is unnecessary, since
at that point the log head offset is guaranteed to be zero due to the previous
operation.

Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBIFS: remove mst_mutex</title>
<updated>2014-07-19T06:53:52Z</updated>
<author>
<name>Artem Bityutskiy</name>
</author>
<published>2014-06-29T13:55:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=07e19dff63e3d5d6500d831e36554ac9b1b0560e'/>
<id>urn:sha1:07e19dff63e3d5d6500d831e36554ac9b1b0560e</id>
<content type='text'>
The 'mst_mutex' is not needed since because 'ubifs_write_master()' is only
called on the mount path and commit path. The mount path is sequential and
there is no parallelism, and the commit path is also serialized - there is only
one commit going on at a time.

Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBIFS: kernel-doc warning fix</title>
<updated>2014-07-19T06:53:52Z</updated>
<author>
<name>Fabian Frederick</name>
</author>
<published>2014-07-15T19:33:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=39274a1e8dd18d47e7ba76a90adc384f14f20a4f'/>
<id>urn:sha1:39274a1e8dd18d47e7ba76a90adc384f14f20a4f</id>
<content type='text'>
s/data/timer

Signed-off-by: Fabian Frederick &lt;fabf@skynet.be&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBIFS: replace seq_printf by seq_puts</title>
<updated>2014-07-19T06:53:52Z</updated>
<author>
<name>Fabian Frederick</name>
</author>
<published>2014-07-15T19:26:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d4eb08ff0a8e1de010252e6646e2fc907a7e9b4e'/>
<id>urn:sha1:d4eb08ff0a8e1de010252e6646e2fc907a7e9b4e</id>
<content type='text'>
Fix checkpatch warnings:
"WARNING: Prefer seq_puts to seq_printf"

Andrew Morton wrote:

"
- puts is presumably faster

- puts doesn't go rogue if you accidentally pass it a "%".

- this patch actually made fs/ubifs/super.o 12 bytes smaller.
  Perhaps because seq_printf() is a varargs function, forcing the
  caller to pass args on the stack instead of in registers.
"

Signed-off-by: Fabian Frederick &lt;fabf@skynet.be&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>UBIFS: replace count*size kzalloc by kcalloc</title>
<updated>2014-07-19T06:53:52Z</updated>
<author>
<name>Fabian Frederick</name>
</author>
<published>2014-06-23T16:41:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=86b4c14de34d19ec3fc4662761feed9918491658'/>
<id>urn:sha1:86b4c14de34d19ec3fc4662761feed9918491658</id>
<content type='text'>
kcalloc manages count*sizeof overflow.

Signed-off-by: Fabian Frederick &lt;fabf@skynet.be&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
</feed>
