* [PATCH] xfs: cow unwritten conversion uses uninitialized dfops
@ 2018-06-26 12:15 Brian Foster
2018-06-26 14:45 ` Darrick J. Wong
2018-06-27 7:41 ` Carlos Maiolino
0 siblings, 2 replies; 3+ messages in thread
From: Brian Foster @ 2018-06-26 12:15 UTC (permalink / raw)
To: linux-xfs
A couple COW fork unwritten extent conversion helpers pass an
uninitialized dfops pointer to xfs_bmapi_write(). This does not
cause problems because conversion does not use a transaction or the
dfops structure for the COW fork. Drop the uninitialized usage of
dfops in these codepaths and pass NULL along to xfs_bmapi_write()
instead.
Signed-off-by: Brian Foster <bfoster@redhat.com>
---
fs/xfs/xfs_reflink.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 592fb2071a03..ff10b5e70029 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -312,8 +312,7 @@ xfs_reflink_convert_cow_extent(
struct xfs_inode *ip,
struct xfs_bmbt_irec *imap,
xfs_fileoff_t offset_fsb,
- xfs_filblks_t count_fsb,
- struct xfs_defer_ops *dfops)
+ xfs_filblks_t count_fsb)
{
xfs_fsblock_t first_block = NULLFSBLOCK;
int nimaps = 1;
@@ -327,7 +326,7 @@ xfs_reflink_convert_cow_extent(
return 0;
return xfs_bmapi_write(NULL, ip, imap->br_startoff, imap->br_blockcount,
XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT, &first_block,
- 0, imap, &nimaps, dfops);
+ 0, imap, &nimaps, NULL);
}
/* Convert all of the unwritten CoW extents in a file's range to real ones. */
@@ -342,7 +341,6 @@ xfs_reflink_convert_cow(
xfs_fileoff_t end_fsb = XFS_B_TO_FSB(mp, offset + count);
xfs_filblks_t count_fsb = end_fsb - offset_fsb;
struct xfs_bmbt_irec imap;
- struct xfs_defer_ops dfops;
xfs_fsblock_t first_block = NULLFSBLOCK;
int nimaps = 1, error = 0;
@@ -352,7 +350,7 @@ xfs_reflink_convert_cow(
error = xfs_bmapi_write(NULL, ip, offset_fsb, count_fsb,
XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT |
XFS_BMAPI_CONVERT_ONLY, &first_block, 0, &imap, &nimaps,
- &dfops);
+ NULL);
xfs_iunlock(ip, XFS_ILOCK_EXCL);
return error;
}
@@ -458,8 +456,7 @@ xfs_reflink_allocate_cow(
if (nimaps == 0)
return -ENOSPC;
convert:
- return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb,
- &dfops);
+ return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb);
out_bmap_cancel:
xfs_defer_cancel(&dfops);
xfs_trans_unreserve_quota_nblks(tp, ip, (long)resblks, 0,
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: cow unwritten conversion uses uninitialized dfops
2018-06-26 12:15 [PATCH] xfs: cow unwritten conversion uses uninitialized dfops Brian Foster
@ 2018-06-26 14:45 ` Darrick J. Wong
2018-06-27 7:41 ` Carlos Maiolino
1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2018-06-26 14:45 UTC (permalink / raw)
To: Brian Foster; +Cc: linux-xfs
On Tue, Jun 26, 2018 at 08:15:02AM -0400, Brian Foster wrote:
> A couple COW fork unwritten extent conversion helpers pass an
> uninitialized dfops pointer to xfs_bmapi_write(). This does not
> cause problems because conversion does not use a transaction or the
> dfops structure for the COW fork. Drop the uninitialized usage of
> dfops in these codepaths and pass NULL along to xfs_bmapi_write()
> instead.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
Looks reasonable, will test...
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
> fs/xfs/xfs_reflink.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 592fb2071a03..ff10b5e70029 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -312,8 +312,7 @@ xfs_reflink_convert_cow_extent(
> struct xfs_inode *ip,
> struct xfs_bmbt_irec *imap,
> xfs_fileoff_t offset_fsb,
> - xfs_filblks_t count_fsb,
> - struct xfs_defer_ops *dfops)
> + xfs_filblks_t count_fsb)
> {
> xfs_fsblock_t first_block = NULLFSBLOCK;
> int nimaps = 1;
> @@ -327,7 +326,7 @@ xfs_reflink_convert_cow_extent(
> return 0;
> return xfs_bmapi_write(NULL, ip, imap->br_startoff, imap->br_blockcount,
> XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT, &first_block,
> - 0, imap, &nimaps, dfops);
> + 0, imap, &nimaps, NULL);
> }
>
> /* Convert all of the unwritten CoW extents in a file's range to real ones. */
> @@ -342,7 +341,6 @@ xfs_reflink_convert_cow(
> xfs_fileoff_t end_fsb = XFS_B_TO_FSB(mp, offset + count);
> xfs_filblks_t count_fsb = end_fsb - offset_fsb;
> struct xfs_bmbt_irec imap;
> - struct xfs_defer_ops dfops;
> xfs_fsblock_t first_block = NULLFSBLOCK;
> int nimaps = 1, error = 0;
>
> @@ -352,7 +350,7 @@ xfs_reflink_convert_cow(
> error = xfs_bmapi_write(NULL, ip, offset_fsb, count_fsb,
> XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT |
> XFS_BMAPI_CONVERT_ONLY, &first_block, 0, &imap, &nimaps,
> - &dfops);
> + NULL);
> xfs_iunlock(ip, XFS_ILOCK_EXCL);
> return error;
> }
> @@ -458,8 +456,7 @@ xfs_reflink_allocate_cow(
> if (nimaps == 0)
> return -ENOSPC;
> convert:
> - return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb,
> - &dfops);
> + return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb);
> out_bmap_cancel:
> xfs_defer_cancel(&dfops);
> xfs_trans_unreserve_quota_nblks(tp, ip, (long)resblks, 0,
> --
> 2.17.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: cow unwritten conversion uses uninitialized dfops
2018-06-26 12:15 [PATCH] xfs: cow unwritten conversion uses uninitialized dfops Brian Foster
2018-06-26 14:45 ` Darrick J. Wong
@ 2018-06-27 7:41 ` Carlos Maiolino
1 sibling, 0 replies; 3+ messages in thread
From: Carlos Maiolino @ 2018-06-27 7:41 UTC (permalink / raw)
To: Brian Foster; +Cc: linux-xfs
On Tue, Jun 26, 2018 at 08:15:02AM -0400, Brian Foster wrote:
> A couple COW fork unwritten extent conversion helpers pass an
> uninitialized dfops pointer to xfs_bmapi_write(). This does not
> cause problems because conversion does not use a transaction or the
> dfops structure for the COW fork. Drop the uninitialized usage of
> dfops in these codepaths and pass NULL along to xfs_bmapi_write()
> instead.
>
This looks ok for me, you can add:
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
> fs/xfs/xfs_reflink.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 592fb2071a03..ff10b5e70029 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -312,8 +312,7 @@ xfs_reflink_convert_cow_extent(
> struct xfs_inode *ip,
> struct xfs_bmbt_irec *imap,
> xfs_fileoff_t offset_fsb,
> - xfs_filblks_t count_fsb,
> - struct xfs_defer_ops *dfops)
> + xfs_filblks_t count_fsb)
> {
> xfs_fsblock_t first_block = NULLFSBLOCK;
> int nimaps = 1;
> @@ -327,7 +326,7 @@ xfs_reflink_convert_cow_extent(
> return 0;
> return xfs_bmapi_write(NULL, ip, imap->br_startoff, imap->br_blockcount,
> XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT, &first_block,
> - 0, imap, &nimaps, dfops);
> + 0, imap, &nimaps, NULL);
> }
>
> /* Convert all of the unwritten CoW extents in a file's range to real ones. */
> @@ -342,7 +341,6 @@ xfs_reflink_convert_cow(
> xfs_fileoff_t end_fsb = XFS_B_TO_FSB(mp, offset + count);
> xfs_filblks_t count_fsb = end_fsb - offset_fsb;
> struct xfs_bmbt_irec imap;
> - struct xfs_defer_ops dfops;
> xfs_fsblock_t first_block = NULLFSBLOCK;
> int nimaps = 1, error = 0;
>
> @@ -352,7 +350,7 @@ xfs_reflink_convert_cow(
> error = xfs_bmapi_write(NULL, ip, offset_fsb, count_fsb,
> XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT |
> XFS_BMAPI_CONVERT_ONLY, &first_block, 0, &imap, &nimaps,
> - &dfops);
> + NULL);
> xfs_iunlock(ip, XFS_ILOCK_EXCL);
> return error;
> }
> @@ -458,8 +456,7 @@ xfs_reflink_allocate_cow(
> if (nimaps == 0)
> return -ENOSPC;
> convert:
> - return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb,
> - &dfops);
> + return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb);
> out_bmap_cancel:
> xfs_defer_cancel(&dfops);
> xfs_trans_unreserve_quota_nblks(tp, ip, (long)resblks, 0,
> --
> 2.17.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Carlos
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-27 7:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-26 12:15 [PATCH] xfs: cow unwritten conversion uses uninitialized dfops Brian Foster
2018-06-26 14:45 ` Darrick J. Wong
2018-06-27 7:41 ` Carlos Maiolino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).