Skip to content

Commit

Permalink
bin/rsync-rootfs: allow use pre-mounted point directly
Browse files Browse the repository at this point in the history
In initramfs case(/osimage/initramfs/initramfs.cgz), we observed that
kernel will crash when mount dev to a 2 levels directory.(/level-1/level-2).
below example will crash the kernel in initramfs:
$ mount -t btrfs /dev/sda1 /opt/rootfs

with this patch, initramfs can pass a pre-mounted point to this tool to avoid
kernel crashing

Signed-off-by: Li Zhijian <[email protected]>
Signed-off-by: Philip Li <[email protected]>
  • Loading branch information
zhijianli88 authored and rli9 committed Nov 18, 2019
1 parent e4bd831 commit a2fa846
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/rsync-rootfs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fs_type=$(blkid -o value -s TYPE $dest_partition)
mkfs.btrfs $opt_mkfs -L "LKP-ROOTFS" ${dest_partition} || exit
}

MNT_POINT=$(cat /proc/mounts | grep -w "$dest_partition" | cut -d' ' -f2)
MNT_POINT=${MNT_POINT:-$(cat /proc/mounts | grep -w "$dest_partition" | cut -d' ' -f2)}
if [ -z "$MNT_POINT" ];then
MNT_POINT="/opt/rootfs"
mkdir -p $MNT_POINT || exit
Expand Down

0 comments on commit a2fa846

Please sign in to comment.