mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
xfs: use ->t_firstblock in xattr ops
Similar to the dirops code, the xattr code uses an on-stack firstblock variable for the various operations. This code rolls the underlying transaction in various places, however, which means we cannot simply replace the local firstblock vars with ->t_firstblock. Doing so (without further changes) would invalidate the memory pointed to by xfs_da_args.firstblock as soon as the first transaction rolls. To avoid this problem, remove xfs_da_args.firstblock and replace all such accesses with ->t_firstblock at the same time. This ensures that accesses to the current firstblock always occur through the current transaction rather than a potentially invalid xfs_da_args pointer. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
parent
825d75cd8c
commit
766139032f
7 changed files with 33 additions and 38 deletions
|
@ -2059,10 +2059,9 @@ xfs_da_grow_inode_int(
|
|||
* Try mapping it in one filesystem block.
|
||||
*/
|
||||
nmap = 1;
|
||||
ASSERT(args->firstblock != NULL);
|
||||
error = xfs_bmapi_write(tp, dp, *bno, count,
|
||||
xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA|XFS_BMAPI_CONTIG,
|
||||
args->firstblock, args->total, &map, &nmap);
|
||||
&tp->t_firstblock, args->total, &map, &nmap);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
@ -2084,7 +2083,7 @@ xfs_da_grow_inode_int(
|
|||
c = (int)(*bno + count - b);
|
||||
error = xfs_bmapi_write(tp, dp, b, c,
|
||||
xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
|
||||
args->firstblock, args->total,
|
||||
&tp->t_firstblock, args->total,
|
||||
&mapp[mapi], &nmap);
|
||||
if (error)
|
||||
goto out_free_map;
|
||||
|
@ -2394,7 +2393,7 @@ xfs_da_shrink_inode(
|
|||
* the last block to the place we want to kill.
|
||||
*/
|
||||
error = xfs_bunmapi(tp, dp, dead_blkno, count,
|
||||
xfs_bmapi_aflag(w), 0, args->firstblock,
|
||||
xfs_bmapi_aflag(w), 0, &tp->t_firstblock,
|
||||
&done);
|
||||
if (error == -ENOSPC) {
|
||||
if (w != XFS_DATA_FORK)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue