]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
btrfs: handle transaction start error in btrfs_fileattr_set
authorRitesh Harjani <riteshh@linux.ibm.com>
Fri, 30 Apr 2021 16:00:55 +0000 (21:30 +0530)
committerDavid Sterba <dsterba@suse.com>
Tue, 11 May 2021 13:35:57 +0000 (15:35 +0200)
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

Fixes: 97fc29775487 ("btrfs: convert to fileattr")
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c

index ee1dbabb5d3c42d35e4be395120729de5383a3d5..98ecb70466bf30b18fbae794549f0d2b587c8339 100644 (file)
@@ -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;
        }