diff mbox series

btrfs: Add error handling in btrfs_fileattr_set for transaction handle

Message ID f24fb4c9f8613fe76f5a7201752152637647f8ba.1619797915.git.riteshh@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series btrfs: Add error handling in btrfs_fileattr_set for transaction handle | expand

Commit Message

Ritesh Harjani April 30, 2021, 4 p.m. UTC
Add error handling in btrfs_fileattr_set in case of an error while
starting a transaction. This fixes btrfs/232 which otherwise used to
fail with below signature on Power.

btrfs/232 [ 1119.474650] run fstests btrfs/232 at 2021-04-21 02:21:22
<...>
[ 1366.638585] BUG: Unable to handle kernel data access on read at 0xffffffffffffff86
[ 1366.638768] Faulting instruction address: 0xc0000000009a5c88
cpu 0x0: Vector: 380 (Data SLB Access) at [c000000014f177b0]
    pc: c0000000009a5c88: btrfs_update_root_times+0x58/0xc0
    lr: c0000000009a5c84: btrfs_update_root_times+0x54/0xc0
    <...>
    pid   = 24881, comm = fsstress
	 btrfs_update_inode+0xa0/0x140
	 btrfs_fileattr_set+0x5d0/0x6f0
	 vfs_fileattr_set+0x2a8/0x390
	 do_vfs_ioctl+0x1290/0x1ac0
	 sys_ioctl+0x6c/0x120
	 system_call_exception+0x3d4/0x410
	 system_call_common+0xec/0x278

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
---
 fs/btrfs/ioctl.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Sterba May 3, 2021, 2:03 p.m. UTC | #1
On Fri, Apr 30, 2021 at 09:30:55PM +0530, Ritesh Harjani wrote:
> Add error handling in btrfs_fileattr_set in case of an error while
> starting a transaction. This fixes btrfs/232 which otherwise used to
> fail with below signature on Power.
> 
> btrfs/232 [ 1119.474650] run fstests btrfs/232 at 2021-04-21 02:21:22
> <...>
> [ 1366.638585] BUG: Unable to handle kernel data access on read at 0xffffffffffffff86
> [ 1366.638768] Faulting instruction address: 0xc0000000009a5c88
> cpu 0x0: Vector: 380 (Data SLB Access) at [c000000014f177b0]
>     pc: c0000000009a5c88: btrfs_update_root_times+0x58/0xc0
>     lr: c0000000009a5c84: btrfs_update_root_times+0x54/0xc0
>     <...>
>     pid   = 24881, comm = fsstress
> 	 btrfs_update_inode+0xa0/0x140
> 	 btrfs_fileattr_set+0x5d0/0x6f0
> 	 vfs_fileattr_set+0x2a8/0x390
> 	 do_vfs_ioctl+0x1290/0x1ac0
> 	 sys_ioctl+0x6c/0x120
> 	 system_call_exception+0x3d4/0x410
> 	 system_call_common+0xec/0x278
> 
> Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>

Thanks.  Added to queue, once misc-next gets synced with master (post
rc1) it'll be added there, until then it'll be in a separate branch
merged to linux-next.
diff mbox series

Patch

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index ee1dbabb5d3c..98ecb70466bf 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -259,6 +259,8 @@  int btrfs_fileattr_set(struct user_namespace *mnt_userns,
 	if (!fa->flags_valid) {
 		/* 1 item for the inode */
 		trans = btrfs_start_transaction(root, 1);
+		if (IS_ERR(trans))
+			return PTR_ERR(trans);
 		goto update_flags;
 	}