<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/block/blk-lib.c, branch v2.6.38</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v2.6.38</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v2.6.38'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2011-03-11T14:36:08+00:00</updated>
<entry>
<title>block: fix mis-synchronisation in blkdev_issue_zeroout()</title>
<updated>2011-03-11T14:36:08+00:00</updated>
<author>
<name>Lukas Czerner</name>
<email>lczerner@redhat.com</email>
</author>
<published>2011-03-11T09:23:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0aeea18964173715a1037034ef6838198f319319'/>
<id>urn:sha1:0aeea18964173715a1037034ef6838198f319319</id>
<content type='text'>
BZ29402
https://bugzilla.kernel.org/show_bug.cgi?id=29402

We can hit serious mis-synchronization in bio completion path of
blkdev_issue_zeroout() leading to a panic.

The problem is that when we are going to wait_for_completion() in
blkdev_issue_zeroout() we check if the bb.done equals issued (number of
submitted bios). If it does, we can skip the wait_for_completition()
and just out of the function since there is nothing to wait for.
However, there is a ordering problem because bio_batch_end_io() is
calling atomic_inc(&amp;bb-&gt;done) before complete(), hence it might seem to
blkdev_issue_zeroout() that all bios has been completed and exit. At
this point when bio_batch_end_io() is going to call complete(bb-&gt;wait),
bb and wait does not longer exist since it was allocated on stack in
blkdev_issue_zeroout() ==&gt; panic!

(thread 1)                      (thread 2)
bio_batch_end_io()              blkdev_issue_zeroout()
  if(bb) {                      ...
    if (bb-&gt;end_io)             ...
      bb-&gt;end_io(bio, err);     ...
    atomic_inc(&amp;bb-&gt;done);      ...
    ...                         while (issued != atomic_read(&amp;bb.done))
    ...                         (let issued == bb.done)
    ...                         (do the rest of the function)
    ...                         return ret;
    complete(bb-&gt;wait);
    ^^^^^^^^
    panic

We can fix this easily by simplifying bio_batch and completion counting.

Also remove bio_end_io_t *end_io since it is not used.

Signed-off-by: Lukas Czerner &lt;lczerner@redhat.com&gt;
Reported-by: Eric Whitney &lt;eric.whitney@hp.com&gt;
Tested-by: Eric Whitney &lt;eric.whitney@hp.com&gt;
Reviewed-by: Jeff Moyer &lt;jmoyer@redhat.com&gt;
CC: Dmitry Monakhov &lt;dmonakhov@openvz.org&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>block: fix kernel-doc format for blkdev_issue_zeroout</title>
<updated>2011-03-01T18:45:24+00:00</updated>
<author>
<name>Ben Hutchings</name>
<email>ben@decadent.org.uk</email>
</author>
<published>2011-03-01T18:45:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=291d24f6d9e7bbef81454fade8a44720665c7302'/>
<id>urn:sha1:291d24f6d9e7bbef81454fade8a44720665c7302</id>
<content type='text'>
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>block: remove BLKDEV_IFL_WAIT</title>
<updated>2010-09-16T18:52:58+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2010-09-16T18:51:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=dd3932eddf428571762596e17b65f5dc92ca361b'/>
<id>urn:sha1:dd3932eddf428571762596e17b65f5dc92ca361b</id>
<content type='text'>
All the blkdev_issue_* helpers can only sanely be used for synchronous
caller.  To issue cache flushes or barriers asynchronously the caller needs
to set up a bio by itself with a completion callback to move the asynchronous
state machine ahead.  So drop the BLKDEV_IFL_WAIT flag that is always
specified when calling blkdev_issue_* and also remove the now unused flags
argument to blkdev_issue_flush and blkdev_issue_zeroout.  For
blkdev_issue_discard we need to keep it for the secure discard flag, which
gains a more descriptive name and loses the bitops vs flag confusion.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>block: remove the BLKDEV_IFL_BARRIER flag</title>
<updated>2010-09-10T10:35:40+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@infradead.org</email>
</author>
<published>2010-08-18T09:29:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8c5553678237b7121355108e03c36086037d8975'/>
<id>urn:sha1:8c5553678237b7121355108e03c36086037d8975</id>
<content type='text'>
Remove support for barriers on discards, which is unused now.  Also
remove the DISCARD_NOBARRIER I/O type in favour of just setting the
rw flags up locally in blkdev_issue_discard.

tj: Also remove DISCARD_SECURE and use REQ_SECURE directly.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>block: add secure discard</title>
<updated>2010-08-12T15:43:30+00:00</updated>
<author>
<name>Adrian Hunter</name>
<email>adrian.hunter@nokia.com</email>
</author>
<published>2010-08-11T21:17:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8d57a98ccd0b4489003473979da8f5a1363ba7a3'/>
<id>urn:sha1:8d57a98ccd0b4489003473979da8f5a1363ba7a3</id>
<content type='text'>
Secure discard is the same as discard except that all copies of the
discarded sectors (perhaps created by garbage collection) must also be
erased.

Signed-off-by: Adrian Hunter &lt;adrian.hunter@nokia.com&gt;
Acked-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Kyungmin Park &lt;kmpark@infradead.org&gt;
Cc: Madhusudhan Chikkature &lt;madhu.cr@ti.com&gt;
Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Ben Gardiner &lt;bengardiner@nanometrics.ca&gt;
Cc: &lt;linux-mmc@vger.kernel.org&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>
<entry>
<title>blkdev: fix blkdev_issue_zeroout return value</title>
<updated>2010-08-08T16:31:08+00:00</updated>
<author>
<name>Dmitry Monakhov</name>
<email>dmonakhov@openvz.org</email>
</author>
<published>2010-08-06T11:23:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=18edc8eaa68070771bdb2098260e44efe74de722'/>
<id>urn:sha1:18edc8eaa68070771bdb2098260e44efe74de722</id>
<content type='text'>
- If function called without barrier option retvalue is incorrect

Signed-off-by: Dmitry Monakhov &lt;dmonakhov@openvz.org&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>block: fix problem with sending down discard that isn't of correct granularity</title>
<updated>2010-08-07T16:26:33+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>jaxboe@fusionio.com</email>
</author>
<published>2010-07-15T16:49:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=10d1f9e2ccfff40665a00ea0e0a0d11e54c9cbb1'/>
<id>urn:sha1:10d1f9e2ccfff40665a00ea0e0a0d11e54c9cbb1</id>
<content type='text'>
If the queue doesn't have a limit set, or it just set UINT_MAX like
we default to, we coud be sending down a discard request that isn't
of the correct granularity if the block size is &gt; 512b.

Fix this by adjusting max_discard_sectors down to the proper
alignment.

Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>block: don't allocate a payload for discard request</title>
<updated>2010-08-07T16:23:08+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2010-06-18T14:59:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=66ac0280197981f88774e74b60c8e5f9f07c1dba'/>
<id>urn:sha1:66ac0280197981f88774e74b60c8e5f9f07c1dba</id>
<content type='text'>
Allocating a fixed payload for discard requests always was a horrible hack,
and it's not coming to byte us when adding support for discard in DM/MD.

So change the code to leave the allocation of a payload to the lowlevel
driver.  Unfortunately that means we'll need another hack, which allows
us to update the various block layer length fields indicating that we
have a payload.  Instead of hiding this in sd.c, which we already partially
do for UNMAP support add a documented helper in the core block layer for it.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Jens Axboe &lt;jaxboe@fusionio.com&gt;
</content>
</entry>
<entry>
<title>block: fix bad use of min() on different types</title>
<updated>2010-04-29T07:28:21+00:00</updated>
<author>
<name>Jens Axboe</name>
<email>jens.axboe@oracle.com</email>
</author>
<published>2010-04-29T07:28:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0341aafb7f3313bcedc6811a098500be85f3fc77'/>
<id>urn:sha1:0341aafb7f3313bcedc6811a098500be85f3fc77</id>
<content type='text'>
Just cast the page size to sector_t, that will always fit.

Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
</entry>
<entry>
<title>blkdev: add blkdev_issue_zeroout helper function</title>
<updated>2010-04-28T17:47:36+00:00</updated>
<author>
<name>Dmitry Monakhov</name>
<email>dmonakhov@openvz.org</email>
</author>
<published>2010-04-28T13:55:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3f14d792f9a8fede64ce918dbb517f934497a4f8'/>
<id>urn:sha1:3f14d792f9a8fede64ce918dbb517f934497a4f8</id>
<content type='text'>
- Add bio_batch helper primitive. This is rather generic primitive
  for submitting/waiting a complex request which consists of several
  bios.
- blkdev_issue_zeroout() generate number of zero filed write bios.

Signed-off-by: Dmitry Monakhov &lt;dmonakhov@openvz.org&gt;
Signed-off-by: Jens Axboe &lt;jens.axboe@oracle.com&gt;
</content>
</entry>
</feed>
