/*
 * linux/fs/befs/io.c
 *
 * Copyright (C) 2001 Will Dyson <will_dyson@pobox.com
 *
 * Based on portions of file.c and inode.c
 * by Makoto Kato (m_kato@ga2.so-net.ne.jp)
 *
 * Many thanks to Dominic Giampaolo, author of Practical File System
 * Design with the Be File System, for such a helpful book.
 *
 */

#include <linux/buffer_head.h>

#include "befs.h"
#include "io.h"

/*
 * Converts befs notion of disk addr to a disk offset and uses
 * linux kernel function sb_bread() to get the buffer containing
 * the offset.
 */

struct buffer_head *
befs_bread_iaddr(struct super_block *sb, befs_inode_addr iaddr)
{
	struct buffer_head *bh;
	befs_blocknr_t block;
	struct befs_sb_info *befs_sb = BEFS_SB(sb);

	befs_debug(sb, "---> Enter %s "
		   "[%u, %hu, %hu]", __func__, iaddr.allocation_group,
		   iaddr.start, iaddr.len);

	if (iaddr.allocation_group > befs_sb->num_ags) {
		befs_error(sb, "BEFS: Invalid allocation group %u, max is %u",
			   iaddr.allocation_group, befs_sb->num_ags);
		goto error;
	}

	block = iaddr2blockno(sb, &iaddr);

	befs_debug(sb, "%s: offset = %lu", __func__, (unsigned long)block);

	bh = sb_bread(sb, block);

	if (bh == NULL) {
		befs_error(sb, "Failed to read block %lu",
			   (unsigned long)block);
		goto error;
	}

	befs_debug(sb, "<--- %s", __func__);
	return bh;

error:
	befs_debug(sb, "<--- %s ERROR", __func__);
	return NULL;
}
k</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/?h=nds-private-remove'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>refs</a><a href='/cgit.cgi/linux/net-next.git/log/fs/Makefile?h=nds-private-remove'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/fs/Makefile?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>tree</a><a class='active' href='/cgit.cgi/linux/net-next.git/commit/fs/Makefile?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/fs/Makefile?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/fs/Makefile'>
<input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/commit/?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>root</a>/<a href='/cgit.cgi/linux/net-next.git/commit/fs?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>fs</a>/<a href='/cgit.cgi/linux/net-next.git/commit/fs/Makefile?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>Makefile</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'>
<tr><th>author</th><td>Sriharsha Basavapatna &lt;sriharsha.basavapatna@broadcom.com&gt;</td><td class='right'>2017-01-09 16:00:44 +0530</td></tr>
<tr><th>committer</th><td>J. Bruce Fields &lt;bfields@redhat.com&gt;</td><td class='right'>2017-01-12 16:14:47 -0500</td></tr>
<tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/fs/Makefile?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>ce1ca7d2d140a1f4aaffd297ac487f246963dd2f</a> (<a href='/cgit.cgi/linux/net-next.git/patch/fs/Makefile?id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>patch</a>)</td></tr>
<tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>5aeab5e0cb6ef404c894a18251588278b9432a2c</a> /<a href='/cgit.cgi/linux/net-next.git/tree/fs/Makefile?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>fs/Makefile</a></td></tr>
<tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/fs/Makefile?h=nds-private-remove&amp;id=546125d1614264d26080817d0c8cddb9b25081fa'>546125d1614264d26080817d0c8cddb9b25081fa</a> (<a href='/cgit.cgi/linux/net-next.git/diff/fs/Makefile?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f&amp;id2=546125d1614264d26080817d0c8cddb9b25081fa'>diff</a>)</td></tr></table>
<div class='commit-subject'>svcrdma: avoid duplicate dma unmapping during error recovery</div><div class='commit-msg'>In rdma_read_chunk_frmr() when ib_post_send() fails, the error code path
invokes ib_dma_unmap_sg() to unmap the sg list. It then invokes
svc_rdma_put_frmr() which in turn tries to unmap the same sg list through
ib_dma_unmap_sg() again. This second unmap is invalid and could lead to
problems when the iova being unmapped is subsequently reused. Remove
the call to unmap in rdma_read_chunk_frmr() and let svc_rdma_put_frmr()
handle it.

Fixes: 412a15c0fe53 ("svcrdma: Port to new memory registration API")
Cc: stable@vger.kernel.org
Signed-off-by: Sriharsha Basavapatna &lt;sriharsha.basavapatna@broadcom.com&gt;
Reviewed-by: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Reviewed-by: Yuval Shaia &lt;yuval.shaia@oracle.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
</div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?h=nds-private-remove&amp;id=ce1ca7d2d140a1f4aaffd297ac487f246963dd2f'>Diffstat</a> (limited to 'fs/Makefile')</div><table summary='diffstat' class='diffstat'>