Skip to contentSkip to conversation

btrfs: print correct subvol num if can't delete because of active swapfile

PATCH In review Mark Harmstone 3 participants 3 messages Feb 18 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs: print correct subvol num if can't delete because of active swapfile

Fix the error message in btrfs_delete_subvolume() if we can't delete a subvolume because it has an active swapfile: we were printing the number of the parent rather than the target.

Fixes 60021bd754c6 ("btrfs: prevent subvol with swapfile from being deleted")
---
 fs/btrfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/inode.c +1 -1
index 4523b689711d..233d91556fe4 100644
@@ -4804,7 +4804,7 @@ int btrfs_delete_subvolume(struct btrfs_inode *dir, struct dentry *dentry)
 		spin_unlock(&dest->root_item_lock);
 		btrfs_warn(fs_info,
 			   "attempt to delete subvolume %llu with active swapfile",
-			   btrfs_root_id(root));
+			   btrfs_root_id(dest));
 		ret = -EPERM;
 		goto out_up_write;
 	}
Signature · 1 line
2.52.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Mark Harmstone

Fix the error message in btrfs_delete_subvolume() if we can't delete a subvolume because it has an active swapfile: we were printing the number of the parent rather than the target.

Fixes 60021bd754c6 ("btrfs: prevent subvol with swapfile from being deleted")

Looks good, thanks.

Quoted 21 lines
---
 fs/btrfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/inode.c +1 -2
index 4523b689711d..233d91556fe4 100644
@@ -4804,7 +4804,7 @@ int btrfs_delete_subvolume(struct btrfs_inode *dir, struct dentry *dentry)
                spin_unlock(&dest->root_item_lock);
                btrfs_warn(fs_info,
                           "attempt to delete subvolume %llu with active swapfile",
-                          btrfs_root_id(root));
+                          btrfs_root_id(dest));
                ret = -EPERM;
                goto out_up_write;
        }
--

2.52.0

Reviewed-by on v1 1/1
#2 lore raw
In reply to Mark Harmstone
Quoted 6 lines · Mark Harmstone

Fix the error message in btrfs_delete_subvolume() if we can't delete a subvolume because it has an active swapfile: we were printing the number of the parent rather than the target.

Fixes 60021bd754c6 ("btrfs: prevent subvol with swapfile from being deleted")

Thanks,
Qu

Quoted 17 lines
---
  fs/btrfs/inode.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/inode.c +1 -1
index 4523b689711d..233d91556fe4 100644
@@ -4804,7 +4804,7 @@ int btrfs_delete_subvolume(struct btrfs_inode *dir, struct dentry *dentry)
  		spin_unlock(&dest->root_item_lock);
  		btrfs_warn(fs_info,
  			   "attempt to delete subvolume %llu with active swapfile",
-			   btrfs_root_id(root));
+			   btrfs_root_id(dest));
  		ret = -EPERM;
  		goto out_up_write;
  	}