xfs: refactor remote attr value buffer invalidation
commit 8edbb26b06023de31ad7d4c9b984d99f66577929 upstream. [Replaced XFS_IS_CORRUPT() calls with ASSERT() for 5.4.y backport] Hoist the code that invalidates remote extended attribute value buffers into a separate helper function. This prepares us for a memory corruption fix in the next patch. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandan.babu@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a1b66abe30
commit
821e0951b4
@ -551,6 +551,32 @@ xfs_attr_rmtval_set(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mark stale any incore buffers for the remote value. */
|
||||||
|
int
|
||||||
|
xfs_attr_rmtval_stale(
|
||||||
|
struct xfs_inode *ip,
|
||||||
|
struct xfs_bmbt_irec *map,
|
||||||
|
xfs_buf_flags_t incore_flags)
|
||||||
|
{
|
||||||
|
struct xfs_mount *mp = ip->i_mount;
|
||||||
|
struct xfs_buf *bp;
|
||||||
|
|
||||||
|
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
|
||||||
|
|
||||||
|
ASSERT((map->br_startblock != DELAYSTARTBLOCK) &&
|
||||||
|
(map->br_startblock != HOLESTARTBLOCK));
|
||||||
|
|
||||||
|
bp = xfs_buf_incore(mp->m_ddev_targp,
|
||||||
|
XFS_FSB_TO_DADDR(mp, map->br_startblock),
|
||||||
|
XFS_FSB_TO_BB(mp, map->br_blockcount), incore_flags);
|
||||||
|
if (bp) {
|
||||||
|
xfs_buf_stale(bp);
|
||||||
|
xfs_buf_relse(bp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove the value associated with an attribute by deleting the
|
* Remove the value associated with an attribute by deleting the
|
||||||
* out-of-line buffer that it is stored on.
|
* out-of-line buffer that it is stored on.
|
||||||
@ -559,7 +585,6 @@ int
|
|||||||
xfs_attr_rmtval_remove(
|
xfs_attr_rmtval_remove(
|
||||||
struct xfs_da_args *args)
|
struct xfs_da_args *args)
|
||||||
{
|
{
|
||||||
struct xfs_mount *mp = args->dp->i_mount;
|
|
||||||
xfs_dablk_t lblkno;
|
xfs_dablk_t lblkno;
|
||||||
int blkcnt;
|
int blkcnt;
|
||||||
int error;
|
int error;
|
||||||
@ -574,9 +599,6 @@ xfs_attr_rmtval_remove(
|
|||||||
blkcnt = args->rmtblkcnt;
|
blkcnt = args->rmtblkcnt;
|
||||||
while (blkcnt > 0) {
|
while (blkcnt > 0) {
|
||||||
struct xfs_bmbt_irec map;
|
struct xfs_bmbt_irec map;
|
||||||
struct xfs_buf *bp;
|
|
||||||
xfs_daddr_t dblkno;
|
|
||||||
int dblkcnt;
|
|
||||||
int nmap;
|
int nmap;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -588,21 +610,9 @@ xfs_attr_rmtval_remove(
|
|||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
ASSERT(nmap == 1);
|
ASSERT(nmap == 1);
|
||||||
ASSERT((map.br_startblock != DELAYSTARTBLOCK) &&
|
error = xfs_attr_rmtval_stale(args->dp, &map, XBF_TRYLOCK);
|
||||||
(map.br_startblock != HOLESTARTBLOCK));
|
if (error)
|
||||||
|
return error;
|
||||||
dblkno = XFS_FSB_TO_DADDR(mp, map.br_startblock),
|
|
||||||
dblkcnt = XFS_FSB_TO_BB(mp, map.br_blockcount);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If the "remote" value is in the cache, remove it.
|
|
||||||
*/
|
|
||||||
bp = xfs_buf_incore(mp->m_ddev_targp, dblkno, dblkcnt, XBF_TRYLOCK);
|
|
||||||
if (bp) {
|
|
||||||
xfs_buf_stale(bp);
|
|
||||||
xfs_buf_relse(bp);
|
|
||||||
bp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
lblkno += map.br_blockcount;
|
lblkno += map.br_blockcount;
|
||||||
blkcnt -= map.br_blockcount;
|
blkcnt -= map.br_blockcount;
|
||||||
|
@ -11,5 +11,7 @@ int xfs_attr3_rmt_blocks(struct xfs_mount *mp, int attrlen);
|
|||||||
int xfs_attr_rmtval_get(struct xfs_da_args *args);
|
int xfs_attr_rmtval_get(struct xfs_da_args *args);
|
||||||
int xfs_attr_rmtval_set(struct xfs_da_args *args);
|
int xfs_attr_rmtval_set(struct xfs_da_args *args);
|
||||||
int xfs_attr_rmtval_remove(struct xfs_da_args *args);
|
int xfs_attr_rmtval_remove(struct xfs_da_args *args);
|
||||||
|
int xfs_attr_rmtval_stale(struct xfs_inode *ip, struct xfs_bmbt_irec *map,
|
||||||
|
xfs_buf_flags_t incore_flags);
|
||||||
|
|
||||||
#endif /* __XFS_ATTR_REMOTE_H__ */
|
#endif /* __XFS_ATTR_REMOTE_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user