<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/md/raid1.c, branch T30_LinuxImageV2.0Beta2_20130626</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>md/raid1: perform bad-block tests for WriteMostly devices too.</title>
<updated>2012-01-18T15:31:57+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2012-01-08T14:41:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ed5eb44d43c04727df9f73863ef276b75df24562'/>
<id>ed5eb44d43c04727df9f73863ef276b75df24562</id>
<content type='text'>
commit 307729c8bc5b5a41361af8af95906eee7552acb1 upstream.

We normally try to avoid reading from write-mostly devices, but when
we do we really have to check for bad blocks and be sure not to
try reading them.

With the current code, best_good_sectors might not get set and that
causes zero-length read requests to be send down which is very
confusing.

This bug was introduced in commit d2eb35acfdccbe2 and so the patch
is suitable for 3.1.x and 3.2.x

Reported-and-tested-by: Michał Mirosław &lt;mirq-linux@rere.qmqm.pl&gt;
Reported-and-tested-by: Art -kwaak- van Breemen &lt;ard@telegraafnet.nl&gt;
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 307729c8bc5b5a41361af8af95906eee7552acb1 upstream.

We normally try to avoid reading from write-mostly devices, but when
we do we really have to check for bad blocks and be sure not to
try reading them.

With the current code, best_good_sectors might not get set and that
causes zero-length read requests to be send down which is very
confusing.

This bug was introduced in commit d2eb35acfdccbe2 and so the patch
is suitable for 3.1.x and 3.2.x

Reported-and-tested-by: Michał Mirosław &lt;mirq-linux@rere.qmqm.pl&gt;
Reported-and-tested-by: Art -kwaak- van Breemen &lt;ard@telegraafnet.nl&gt;
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>md: Avoid waking up a thread after it has been freed.</title>
<updated>2011-09-21T05:30:20+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2011-09-21T05:30:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=01f96c0a9922cd9919baf9d16febdf7016177a12'/>
<id>01f96c0a9922cd9919baf9d16febdf7016177a12</id>
<content type='text'>
Two related problems:

1/ some error paths call "md_unregister_thread(mddev-&gt;thread)"
   without subsequently clearing -&gt;thread.  A subsequent call
   to mddev_unlock will try to wake the thread, and crash.

2/ Most calls to md_wakeup_thread are protected against the thread
   disappeared either by:
      - holding the -&gt;mutex
      - having an active request, so something else must be keeping
        the array active.
   However mddev_unlock calls md_wakeup_thread after dropping the
   mutex and without any certainty of an active request, so the
   -&gt;thread could theoretically disappear.
   So we need a spinlock to provide some protections.

So change md_unregister_thread to take a pointer to the thread
pointer, and ensure that it always does the required locking, and
clears the pointer properly.

Reported-by: "Moshe Melnikov" &lt;moshe@zadarastorage.com&gt;
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
cc: stable@kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Two related problems:

1/ some error paths call "md_unregister_thread(mddev-&gt;thread)"
   without subsequently clearing -&gt;thread.  A subsequent call
   to mddev_unlock will try to wake the thread, and crash.

2/ Most calls to md_wakeup_thread are protected against the thread
   disappeared either by:
      - holding the -&gt;mutex
      - having an active request, so something else must be keeping
        the array active.
   However mddev_unlock calls md_wakeup_thread after dropping the
   mutex and without any certainty of an active request, so the
   -&gt;thread could theoretically disappear.
   So we need a spinlock to provide some protections.

So change md_unregister_thread to take a pointer to the thread
pointer, and ensure that it always does the required locking, and
clears the pointer properly.

Reported-by: "Moshe Melnikov" &lt;moshe@zadarastorage.com&gt;
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
cc: stable@kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>md/raid1,10: Remove use-after-free bug in make_request.</title>
<updated>2011-09-10T07:21:23+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2011-09-10T07:21:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=079fa166a2874985ae58b2e21e26e1cbc91127d4'/>
<id>079fa166a2874985ae58b2e21e26e1cbc91127d4</id>
<content type='text'>
A single request to RAID1 or RAID10 might result in multiple
requests if there are known bad blocks that need to be avoided.

To detect if we need to submit another write request we test:
 	if (sectors_handled &lt; (bio-&gt;bi_size &gt;&gt; 9)) {

However this is after we call **_write_done() so the 'bio' no longer
belongs to us - the writes could have completed and the bio freed.

So move the **_write_done call until after the test against
bio-&gt;bi_size.

This addresses https://bugzilla.kernel.org/show_bug.cgi?id=41862

Reported-by: Bruno Wolff III &lt;bruno@wolff.to&gt;
Tested-by: Bruno Wolff III &lt;bruno@wolff.to&gt;
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A single request to RAID1 or RAID10 might result in multiple
requests if there are known bad blocks that need to be avoided.

To detect if we need to submit another write request we test:
 	if (sectors_handled &lt; (bio-&gt;bi_size &gt;&gt; 9)) {

However this is after we call **_write_done() so the 'bio' no longer
belongs to us - the writes could have completed and the bio freed.

So move the **_write_done call until after the test against
bio-&gt;bi_size.

This addresses https://bugzilla.kernel.org/show_bug.cgi?id=41862

Reported-by: Bruno Wolff III &lt;bruno@wolff.to&gt;
Tested-by: Bruno Wolff III &lt;bruno@wolff.to&gt;
Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>md/raid1: factor several functions out or raid1d()</title>
<updated>2011-07-28T01:38:13+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2011-07-28T01:38:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=62096bce231b3760882ed91205fc84682d6b0529'/>
<id>62096bce231b3760882ed91205fc84682d6b0529</id>
<content type='text'>
raid1d is too big with several deep branches.
So separate them out into their own functions.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
raid1d is too big with several deep branches.
So separate them out into their own functions.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>md/raid1: improve handling of read failure during recovery.</title>
<updated>2011-07-28T01:33:42+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2011-07-28T01:33:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3a9f28a5117e00a868dd8b4395f9a707ae56764b'/>
<id>3a9f28a5117e00a868dd8b4395f9a707ae56764b</id>
<content type='text'>
If we cannot read a block from anywhere during recovery, there is
now a better approach than just giving up.
We can record a bad block on each device and keep going - being
careful not to clear the bad block when a write succeeds as it might -
it will be a write of incorrect data.

We have now reached the state where - for raid1 - we only call
md_error if md_set_badblocks has failed.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we cannot read a block from anywhere during recovery, there is
now a better approach than just giving up.
We can record a bad block on each device and keep going - being
careful not to clear the bad block when a write succeeds as it might -
it will be a write of incorrect data.

We have now reached the state where - for raid1 - we only call
md_error if md_set_badblocks has failed.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>md/raid1: record badblocks found during resync etc.</title>
<updated>2011-07-28T01:33:00+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2011-07-28T01:33:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d8f05d2995d467a91db1af01637e6ffd94660ca8'/>
<id>d8f05d2995d467a91db1af01637e6ffd94660ca8</id>
<content type='text'>
If we find a bad block while writing as part of resync/recovery we
need to report that back to raid1d which must record the bad block,
or fail the device.

Similarly when fixing a read error, a further error should just
record a bad block if possible rather than failing the device.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we find a bad block while writing as part of resync/recovery we
need to report that back to raid1d which must record the bad block,
or fail the device.

Similarly when fixing a read error, a further error should just
record a bad block if possible rather than failing the device.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>md/raid1:  Handle write errors by updating badblock log.</title>
<updated>2011-07-28T01:32:41+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2011-07-28T01:32:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=cd5ff9a16f0831f68c1024d5d776075b5123b034'/>
<id>cd5ff9a16f0831f68c1024d5d776075b5123b034</id>
<content type='text'>
When we get a write error (in the data area, not in metadata),
update the badblock log rather than failing the whole device.

As the write may well be many blocks, we trying writing each
block individually and only log the ones which fail.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When we get a write error (in the data area, not in metadata),
update the badblock log rather than failing the whole device.

As the write may well be many blocks, we trying writing each
block individually and only log the ones which fail.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>md/raid1: store behind-write pages in bi_vecs.</title>
<updated>2011-07-28T01:32:10+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2011-07-28T01:32:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2ca68f5ed7383733102ee53cd8fa4021ecc3b275'/>
<id>2ca68f5ed7383733102ee53cd8fa4021ecc3b275</id>
<content type='text'>
When performing write-behind we allocate pages to store the data
during write.
Previously we just keep a list of pages.  Now we keep a list of
bi_vec which includes offset and size.
This means that the r1bio has complete information to create a new
bio which will be needed for retrying after write errors.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When performing write-behind we allocate pages to store the data
during write.
Previously we just keep a list of pages.  Now we keep a list of
bi_vec which includes offset and size.
This means that the r1bio has complete information to create a new
bio which will be needed for retrying after write errors.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>md/raid1: clear bad-block record when write succeeds.</title>
<updated>2011-07-28T01:31:49+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2011-07-28T01:31:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=4367af556133723d0f443e14ca8170d9447317cb'/>
<id>4367af556133723d0f443e14ca8170d9447317cb</id>
<content type='text'>
If we succeed in writing to a block that was recorded as
being bad, we clear the bad-block record.

This requires some delayed handling as the bad-block-list update has
to happen in process-context.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we succeed in writing to a block that was recorded as
being bad, we clear the bad-block record.

This requires some delayed handling as the bad-block-list update has
to happen in process-context.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>md/raid1: avoid writing to known-bad blocks on known-bad drives.</title>
<updated>2011-07-28T01:31:48+00:00</updated>
<author>
<name>NeilBrown</name>
<email>neilb@suse.de</email>
</author>
<published>2011-07-28T01:31:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1f68f0c4b677ccd6935ff61e4e6888787505f8dc'/>
<id>1f68f0c4b677ccd6935ff61e4e6888787505f8dc</id>
<content type='text'>
If we have seen any write error on a drive, then don't write to
any known-bad blocks on that drive.
If necessary, we divide the write request up into pieces just
like we do for reads, so each piece is either all written or
all not written to any given drive.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we have seen any write error on a drive, then don't write to
any known-bad blocks on that drive.
If necessary, we divide the write request up into pieces just
like we do for reads, so each piece is either all written or
all not written to any given drive.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Reviewed-by: Namhyung Kim &lt;namhyung@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
