<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/md/dm-flakey.c, branch v3.6-rc2</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>dm thin: commit before gathering status</title>
<updated>2012-07-27T14:08:16+00:00</updated>
<author>
<name>Alasdair G Kergon</name>
<email>agk@redhat.com</email>
</author>
<published>2012-07-27T14:08:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1f4e0ff07980820977f45d6a5dbc81d3bb9ce4d3'/>
<id>1f4e0ff07980820977f45d6a5dbc81d3bb9ce4d3</id>
<content type='text'>
Commit outstanding metadata before returning the status for a dm thin
pool so that the numbers reported are as up-to-date as possible.

The commit is not performed if the device is suspended or if
the DM_NOFLUSH_FLAG is supplied by userspace and passed to the target
through a new 'status_flags' parameter in the target's dm_status_fn.

The userspace dmsetup tool will support the --noflush flag with the
'dmsetup status' and 'dmsetup wait' commands from version 1.02.76
onwards.

Tested-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit outstanding metadata before returning the status for a dm thin
pool so that the numbers reported are as up-to-date as possible.

The commit is not performed if the device is suspended or if
the DM_NOFLUSH_FLAG is supplied by userspace and passed to the target
through a new 'status_flags' parameter in the target's dm_status_fn.

The userspace dmsetup tool will support the --noflush flag with the
'dmsetup status' and 'dmsetup wait' commands from version 1.02.76
onwards.

Tested-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: reject trailing characters in sccanf input</title>
<updated>2012-03-28T17:41:26+00:00</updated>
<author>
<name>Mikulas Patocka</name>
<email>mpatocka@redhat.com</email>
</author>
<published>2012-03-28T17:41:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=31998ef19385c944600d9a981b96252f98204bee'/>
<id>31998ef19385c944600d9a981b96252f98204bee</id>
<content type='text'>
Device mapper uses sscanf to convert arguments to numbers. The problem is that
the way we use it ignores additional unmatched characters in the scanned string.

For example, this `if (sscanf(string, "%d", &amp;number) == 1)' will match a number,
but also it will match number with some garbage appended, like "123abc".

As a result, device mapper accepts garbage after some numbers. For example
the command `dmsetup create vg1-new --table "0 16384 linear 254:1bla 34816bla"'
will pass without an error.

This patch fixes all sscanf uses in device mapper. It appends "%c" with
a pointer to a dummy character variable to every sscanf statement.

The construct `if (sscanf(string, "%d%c", &amp;number, &amp;dummy) == 1)' succeeds
only if string is a null-terminated number (optionally preceded by some
whitespace characters). If there is some character appended after the number,
sscanf matches "%c", writes the character to the dummy variable and returns 2.
We check the return value for 1 and consequently reject numbers with some
garbage appended.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Acked-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Device mapper uses sscanf to convert arguments to numbers. The problem is that
the way we use it ignores additional unmatched characters in the scanned string.

For example, this `if (sscanf(string, "%d", &amp;number) == 1)' will match a number,
but also it will match number with some garbage appended, like "123abc".

As a result, device mapper accepts garbage after some numbers. For example
the command `dmsetup create vg1-new --table "0 16384 linear 254:1bla 34816bla"'
will pass without an error.

This patch fixes all sscanf uses in device mapper. It appends "%c" with
a pointer to a dummy character variable to every sscanf statement.

The construct `if (sscanf(string, "%d%c", &amp;number, &amp;dummy) == 1)' succeeds
only if string is a null-terminated number (optionally preceded by some
whitespace characters). If there is some character appended after the number,
sscanf matches "%c", writes the character to the dummy variable and returns 2.
We check the return value for 1 and consequently reject numbers with some
garbage appended.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Acked-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm flakey: fix crash on read when corrupt_bio_byte not set</title>
<updated>2012-03-07T19:09:39+00:00</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2012-03-07T19:09:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1212268fd9816e3b8801e57b896fceaec71969ad'/>
<id>1212268fd9816e3b8801e57b896fceaec71969ad</id>
<content type='text'>
The following BUG is hit on the first read that is submitted to a dm
flakey test device while the device is "down" if the corrupt_bio_byte
feature wasn't requested when the device's table was loaded.

Example DM table that will hit this BUG:
0 2097152 flakey 8:0 2048 0 30

This bug was introduced by commit a3998799fb4df0b0af8271a7d50c4269032397aa
(dm flakey: add corrupt_bio_byte feature) in v3.1-rc1.

BUG: unable to handle kernel paging request at ffff8801cfce3fff
IP: [&lt;ffffffffa008c233&gt;] corrupt_bio_data+0x6e/0xae [dm_flakey]
PGD 1606063 PUD 0
Oops: 0002 [#1] SMP
...
Call Trace:
 &lt;IRQ&gt;
 [&lt;ffffffffa008c2b5&gt;] flakey_end_io+0x42/0x48 [dm_flakey]
 [&lt;ffffffffa00dca98&gt;] clone_endio+0x54/0xb6 [dm_mod]
 [&lt;ffffffff81130587&gt;] bio_endio+0x2d/0x2f
 [&lt;ffffffff811c819a&gt;] req_bio_endio+0x96/0x9f
 [&lt;ffffffff811c94b9&gt;] blk_update_request+0x1dc/0x3a9
 [&lt;ffffffff812f5ee2&gt;] ? rcu_read_unlock+0x21/0x23
 [&lt;ffffffff811c96a6&gt;] blk_update_bidi_request+0x20/0x6e
 [&lt;ffffffff811c9713&gt;] blk_end_bidi_request+0x1f/0x5d
 [&lt;ffffffff811c978d&gt;] blk_end_request+0x10/0x12
 [&lt;ffffffff8128f450&gt;] scsi_io_completion+0x1e5/0x4b1
 [&lt;ffffffff812882a9&gt;] scsi_finish_command+0xec/0xf5
 [&lt;ffffffff8128f830&gt;] scsi_softirq_done+0xff/0x108
 [&lt;ffffffff811ce284&gt;] blk_done_softirq+0x84/0x98
 [&lt;ffffffff81048d19&gt;] __do_softirq+0xe3/0x1d5
 [&lt;ffffffff8138f83f&gt;] ? _raw_spin_lock+0x62/0x69
 [&lt;ffffffff810997cf&gt;] ? handle_irq_event+0x4c/0x61
 [&lt;ffffffff8139833c&gt;] call_softirq+0x1c/0x30
 [&lt;ffffffff81003b37&gt;] do_softirq+0x4b/0xa3
 [&lt;ffffffff81048a39&gt;] irq_exit+0x53/0xca
 [&lt;ffffffff81398acd&gt;] do_IRQ+0x9d/0xb4
 [&lt;ffffffff81390333&gt;] common_interrupt+0x73/0x73
...

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Cc: stable@vger.kernel.org # 3.1+
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The following BUG is hit on the first read that is submitted to a dm
flakey test device while the device is "down" if the corrupt_bio_byte
feature wasn't requested when the device's table was loaded.

Example DM table that will hit this BUG:
0 2097152 flakey 8:0 2048 0 30

This bug was introduced by commit a3998799fb4df0b0af8271a7d50c4269032397aa
(dm flakey: add corrupt_bio_byte feature) in v3.1-rc1.

BUG: unable to handle kernel paging request at ffff8801cfce3fff
IP: [&lt;ffffffffa008c233&gt;] corrupt_bio_data+0x6e/0xae [dm_flakey]
PGD 1606063 PUD 0
Oops: 0002 [#1] SMP
...
Call Trace:
 &lt;IRQ&gt;
 [&lt;ffffffffa008c2b5&gt;] flakey_end_io+0x42/0x48 [dm_flakey]
 [&lt;ffffffffa00dca98&gt;] clone_endio+0x54/0xb6 [dm_mod]
 [&lt;ffffffff81130587&gt;] bio_endio+0x2d/0x2f
 [&lt;ffffffff811c819a&gt;] req_bio_endio+0x96/0x9f
 [&lt;ffffffff811c94b9&gt;] blk_update_request+0x1dc/0x3a9
 [&lt;ffffffff812f5ee2&gt;] ? rcu_read_unlock+0x21/0x23
 [&lt;ffffffff811c96a6&gt;] blk_update_bidi_request+0x20/0x6e
 [&lt;ffffffff811c9713&gt;] blk_end_bidi_request+0x1f/0x5d
 [&lt;ffffffff811c978d&gt;] blk_end_request+0x10/0x12
 [&lt;ffffffff8128f450&gt;] scsi_io_completion+0x1e5/0x4b1
 [&lt;ffffffff812882a9&gt;] scsi_finish_command+0xec/0xf5
 [&lt;ffffffff8128f830&gt;] scsi_softirq_done+0xff/0x108
 [&lt;ffffffff811ce284&gt;] blk_done_softirq+0x84/0x98
 [&lt;ffffffff81048d19&gt;] __do_softirq+0xe3/0x1d5
 [&lt;ffffffff8138f83f&gt;] ? _raw_spin_lock+0x62/0x69
 [&lt;ffffffff810997cf&gt;] ? handle_irq_event+0x4c/0x61
 [&lt;ffffffff8139833c&gt;] call_softirq+0x1c/0x30
 [&lt;ffffffff81003b37&gt;] do_softirq+0x4b/0xa3
 [&lt;ffffffff81048a39&gt;] irq_exit+0x53/0xca
 [&lt;ffffffff81398acd&gt;] do_IRQ+0x9d/0xb4
 [&lt;ffffffff81390333&gt;] common_interrupt+0x73/0x73
...

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Cc: stable@vger.kernel.org # 3.1+
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: do not forward ioctls from logical volumes to the underlying device</title>
<updated>2012-01-14T23:07:24+00:00</updated>
<author>
<name>Paolo Bonzini</name>
<email>pbonzini@redhat.com</email>
</author>
<published>2012-01-12T15:01:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ec8013beddd717d1740cfefb1a9b900deef85462'/>
<id>ec8013beddd717d1740cfefb1a9b900deef85462</id>
<content type='text'>
A logical volume can map to just part of underlying physical volume.
In this case, it must be treated like a partition.

Based on a patch from Alasdair G Kergon.

Cc: Alasdair G Kergon &lt;agk@redhat.com&gt;
Cc: dm-devel@redhat.com
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A logical volume can map to just part of underlying physical volume.
In this case, it must be treated like a partition.

Based on a patch from Alasdair G Kergon.

Cc: Alasdair G Kergon &lt;agk@redhat.com&gt;
Cc: dm-devel@redhat.com
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: flakey fix corrupt_bio_byte error path</title>
<updated>2011-09-25T22:26:15+00:00</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2011-09-25T22:26:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=68e58a294fb26f692697179e3f3ecf88dd8cb97c'/>
<id>68e58a294fb26f692697179e3f3ecf88dd8cb97c</id>
<content type='text'>
If no arguments were provided to the corrupt_bio_byte feature an error
should be returned immediately.

Reported-by: Zdenek Kabelac &lt;zkabelac@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If no arguments were provided to the corrupt_bio_byte feature an error
should be returned immediately.

Reported-by: Zdenek Kabelac &lt;zkabelac@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm flakey: add corrupt_bio_byte feature</title>
<updated>2011-08-02T11:32:06+00:00</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2011-08-02T11:32:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a3998799fb4df0b0af8271a7d50c4269032397aa'/>
<id>a3998799fb4df0b0af8271a7d50c4269032397aa</id>
<content type='text'>
Add corrupt_bio_byte feature to simulate corruption by overwriting a byte at a
specified position with a specified value during intervals when the device is
"down".

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add corrupt_bio_byte feature to simulate corruption by overwriting a byte at a
specified position with a specified value during intervals when the device is
"down".

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm flakey: add drop_writes</title>
<updated>2011-08-02T11:32:05+00:00</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2011-08-02T11:32:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b26f5e3d7127487e934758c1fbe05d683b082cb0'/>
<id>b26f5e3d7127487e934758c1fbe05d683b082cb0</id>
<content type='text'>
Add 'drop_writes' option to drop writes silently while the
device is 'down'.  Reads are not touched.

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add 'drop_writes' option to drop writes silently while the
device is 'down'.  Reads are not touched.

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm flakey: support feature args</title>
<updated>2011-08-02T11:32:05+00:00</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2011-08-02T11:32:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=dfd068b01f02653c6650f1c0eda443b2655d1471'/>
<id>dfd068b01f02653c6650f1c0eda443b2655d1471</id>
<content type='text'>
Add the ability to specify arbitrary feature flags when creating a
flakey target.  This code uses the same target argument helpers that
the multipath target does.

Also remove the superfluous 'dm-flakey' prefixes from the error messages,
as they already contain the prefix 'flakey'.

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add the ability to specify arbitrary feature flags when creating a
flakey target.  This code uses the same target argument helpers that
the multipath target does.

Also remove the superfluous 'dm-flakey' prefixes from the error messages,
as they already contain the prefix 'flakey'.

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm flakey: use dm_target_offset and support discards</title>
<updated>2011-08-02T11:32:05+00:00</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2011-08-02T11:32:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=30e4171bfe3d1c49689803338005cc0071dddaff'/>
<id>30e4171bfe3d1c49689803338005cc0071dddaff</id>
<content type='text'>
Use dm_target_offset() and support discards.

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use dm_target_offset() and support discards.

Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>dm: add flakey target</title>
<updated>2011-03-24T13:54:24+00:00</updated>
<author>
<name>Josef Bacik</name>
<email>josef@redhat.com</email>
</author>
<published>2011-03-24T13:54:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3407ef5262b55ca5d7139d2b555ef792fe531eec'/>
<id>3407ef5262b55ca5d7139d2b555ef792fe531eec</id>
<content type='text'>
This target is the same as the linear target except that it returns I/O
errors periodically.  It's been found useful in simulating failing
devices for testing purposes.

I needed a dm target to do some failure testing on btrfs's raid code, and
Mike pointed me at this.

Signed-off-by: Josef Bacik &lt;josef@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This target is the same as the linear target except that it returns I/O
errors periodically.  It's been found useful in simulating failing
devices for testing purposes.

I needed a dm target to do some failure testing on btrfs's raid code, and
Mike pointed me at this.

Signed-off-by: Josef Bacik &lt;josef@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
