On Mon, Jan 19, 2015 at 03:42:41PM +0800, Qu Wenruo wrote:
> The fix is to check if the fs is frozen, if the fs is frozen, just
> return and waiting for the next transaction.
> 
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -1000,6 +1000,14 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
>                        */
>                       if (fs_info->pending_changes == 0)
>                               return 0;
> +                     /*
> +                      * Test if the fs is frozen, or start_trasaction
> +                      * will deadlock on itself.
> +                      */
> +                     if (__sb_start_write(sb, SB_FREEZE_FS, false))
> +                             __sb_end_write(sb, SB_FREEZE_FS);
> +                     else
> +                             return 0;

I'm not sure this is the right fix. We should use either
mnt_want_write_file or sb_start_write around the start/commit functions.
The fs may be frozen already, but we also have to catch transition to
that state, or RO remount.

Also, returning 0 is not right, the ioctl actually skipped the expected
work.

>                       trans = btrfs_start_transaction(root, 0);
>               } else {
>                       return PTR_ERR(trans);
--
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