On Fri, Apr 20, 2018 at 05:13:02PM +0800, Anand Jain wrote:
> 
> 
> 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); ?

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

Reply via email to