Re: [PATCH v2 13/16] btrfs: move and comment read-only check in btrfs_cancel_balance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 04/20/2018 12:33 AM, David Sterba wrote:
Balance cannot be started on a read-only filesystem and will have to
finish/exit before eg. going to read-only via remount.

 It can be paused as well.
   btrfs balance pause /btrfs && mount -o remount,ro /dev/sdb /btrfs


@@ -4053,15 +4053,20 @@ int btrfs_pause_balance(struct btrfs_fs_info *fs_info)
int btrfs_cancel_balance(struct btrfs_fs_info *fs_info)
  {
-	if (sb_rdonly(fs_info->sb))
-		return -EROFS;
-
  	mutex_lock(&fs_info->balance_mutex);
  	if (!fs_info->balance_ctl) {
  		mutex_unlock(&fs_info->balance_mutex);
  		return -ENOTCONN;
  	}
+ /*
+	 * A paused balance with the item stored on disk can be resumed at
+	 * mount time if the mount is read-write. Otherwise it's still paused
+	 * and we must not allow cancelling as it deletes the item.
+	 */
+	if (sb_rdonly(fs_info->sb))
+		return -EROFS;
+

  mutex_unlock(&fs_info->balance_mutex); ?

Thanks, Anand

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux