btrfs-progs: convert: Fix a regression that ext2_save/image is not readonly
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Fri, 19 Aug 2016 08:13:05 +0000 (16:13 +0800)
committerDavid Sterba <dsterba@suse.com>
Fri, 19 Aug 2016 11:52:43 +0000 (13:52 +0200)
commitbdadea75e47f21682b745678c9b685e491c5e8a3
tree8bd80719e08007a1e44793ea1968392944194b5e
parent55aa862ea21c733cbc0444955006856321e9e957
btrfs-progs: convert: Fix a regression that ext2_save/image is not readonly

The new convert treats the convert image as a normal file, without any
special flags and permissions.

This is different from original code:
1) Permission changed from 0400 to 0600
2) Inode lacks READONLY flag

This makes we can read-write mount the ext2 image and cause rollback
failure.

Follow old code behavior, use 0400 permission and add back READONLY
flag to fix it.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
btrfs-convert.c
ctree.h
inode.c