Skip to contentSkip to conversation

xfs: fix backwards logic in xfs_bmap_alloc_account

PATCH In review Darrick J. Wong 3 participants 6 messages Jan 9, 2024 – Jan 10, 2024 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix backwards logic in xfs_bmap_alloc_account

From: Darrick J. Wong <[email protected]>

We're only allocating from the realtime device if the inode is marked for realtime and we're /not/ allocating into the attr fork.

Fixes 8a3cf489410dd ("xfs: also use xfs_bmap_btalloc_accounting for RT allocations")
---
 fs/xfs/libxfs/xfs_bmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_bmap.c +1 -1
index ed7e11697249e..e1f2e61cb308e 100644
@@ -3320,7 +3320,7 @@ xfs_bmap_alloc_account(
 	struct xfs_bmalloca	*ap)
 {
 	bool			isrt = XFS_IS_REALTIME_INODE(ap->ip) &&
-					(ap->flags & XFS_BMAPI_ATTRFORK);
+					!(ap->flags & XFS_BMAPI_ATTRFORK);
 	uint			fld;
 
 	if (ap->flags & XFS_BMAPI_COWFORK) {
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

We're only allocating from the realtime device if the inode is marked for realtime and we're /not/ allocating into the attr fork.

Hmm, interesting how this survived all my rtalloc tests. How did you find this?

#2 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

We're only allocating from the realtime device if the inode is marked for realtime and we're /not/ allocating into the attr fork.

Hmm, interesting how this survived all my rtalloc tests. How did you find this?

I actually found it while reabasing the rt reflink patchset atop for-next, because you unified the bmap allocator accounting functions instead of copy-pasting them like I did. Then I tried generic/476 and it blew up the first time it encountered a reflink file.

Quoted 1 line

Thanks! Chandan, can we get this merged?

--D

#3 lore raw
Quoted 10 lines · Darrick J. Wong
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

We're only allocating from the realtime device if the inode is marked for realtime and we're /not/ allocating into the attr fork.

Hmm, interesting how this survived all my rtalloc tests. How did you find this?

Quoted 8 lines

I actually found it while reabasing the rt reflink patchset atop for-next, because you unified the bmap allocator accounting functions instead of copy-pasting them like I did. Then I tried generic/476 and it blew up the first time it encountered a reflink file.

Quoted 1 line

Thanks! Chandan, can we get this merged?

I have picked up the patch and will update for-next soon. I will send the second pull request for v6.8-rc1 on coming Monday if everything goes well.

Signature · 1 line
Chandan
#4 lore raw
In reply to Darrick J. Wong
Quoted 6 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

We're only allocating from the realtime device if the inode is marked for realtime and we're /not/ allocating into the attr fork.

Fixes 8a3cf489410dd ("xfs: also use xfs_bmap_btalloc_accounting for RT allocations")

The commit ID should be 58643460546d
(https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git/commit/?id=58643460546da1dc61593fc6fd78762798b4534f)
right?

If yes, I will fix it before pushing it for-next.

Quoted 18 lines
---
 fs/xfs/libxfs/xfs_bmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_bmap.c +1 -1
index ed7e11697249e..e1f2e61cb308e 100644
@@ -3320,7 +3320,7 @@ xfs_bmap_alloc_account(
 	struct xfs_bmalloca	*ap)
 {
 	bool			isrt = XFS_IS_REALTIME_INODE(ap->ip) &&
-					(ap->flags & XFS_BMAPI_ATTRFORK);
+					!(ap->flags & XFS_BMAPI_ATTRFORK);
 	uint			fld;
 
 	if (ap->flags & XFS_BMAPI_COWFORK) {
Signature · 1 line
Chandan
#5 lore raw
Quoted 6 lines · Chandan Babu R
Quoted 5 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

We're only allocating from the realtime device if the inode is marked for realtime and we're /not/ allocating into the attr fork.

Quoted 7 lines
Quoted 1 line
Fixes 8a3cf489410dd ("xfs: also use xfs_bmap_btalloc_accounting for RT allocations")

The commit ID should be 58643460546d
(https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git/commit/?id=58643460546da1dc61593fc6fd78762798b4534f)
right?

If yes, I will fix it before pushing it for-next.

Yes. Apparently I ran git blame on the wrong branch. :(

--D

Quoted 22 lines
Quoted 18 lines
---
 fs/xfs/libxfs/xfs_bmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_bmap.c +1 -1
index ed7e11697249e..e1f2e61cb308e 100644
@@ -3320,7 +3320,7 @@ xfs_bmap_alloc_account(
 	struct xfs_bmalloca	*ap)
 {
 	bool			isrt = XFS_IS_REALTIME_INODE(ap->ip) &&
-					(ap->flags & XFS_BMAPI_ATTRFORK);
+					!(ap->flags & XFS_BMAPI_ATTRFORK);
 	uint			fld;
 
 	if (ap->flags & XFS_BMAPI_COWFORK) {
Signature · 1 line
Chandan