From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jordi Pujol Subject: Re: overlayfs: mounting overlayfs on top of overlayfs Date: Sat, 4 Jun 2011 08:23:24 +0200 Message-ID: <201106040823.25072.jordipujolp@gmail.com> References: <201106031529.30103.jordipujolp@gmail.com> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_c9c6Nc0nLcj91CJ" Cc: linux-fsdevel@vger.kernel.org, Michal Suchanek To: Miklos Szeredi Return-path: Received: from mail-wy0-f174.google.com ([74.125.82.174]:55724 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752068Ab1FDGXa (ORCPT ); Sat, 4 Jun 2011 02:23:30 -0400 Received: by wya21 with SMTP id 21so1811057wya.19 for ; Fri, 03 Jun 2011 23:23:29 -0700 (PDT) In-Reply-To: <201106031529.30103.jordipujolp@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: --Boundary-00=_c9c6Nc0nLcj91CJ Content-Type: Text/Plain; charset="ibm874" Content-Transfer-Encoding: 7bit Hello, Here is attached an automated script that creates his own test data and reproduces the problem, I have observed that the problem does not appear when we use as lower dir a read/write directory and not an squashfs compressed file. Thanks, Jordi Pujol Live never ending Tale GNU/Linux Live forever! http://livenet.selfip.com --Boundary-00=_c9c6Nc0nLcj91CJ Content-Type: application/x-shellscript; name="test06.sh" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test06.sh" #!/bin/sh set -x set -e _sample_data() { local p="${1}" local l="$(mktemp -d -p "${WORK_DIR}")" local d="${l}${p}" ( mkdir -p "${d}" mktemp -p "${d}" mktemp -p "${d}" mktemp -p "${d}" mksquashfs "${l}" "${l}.squashfs" -b 1M rm -rf "${l}" ) > "/dev/null" echo "${l}.squashfs" } _overlayfs_test() { local d="${1}" local rc="0" local f for f in $(find "${d}" -type f); do sed -i -e 's|a|a|g' "${f}" || rc="1" done if [ "${rc}" != "0" ]; then for f in $(find "${d}" -type f); do touch "${f}" done for f in $(find "${d}" -type f); do sed -i -e 's|a|a|g' "${f}" done fi } WORK_DIR="$(mktemp -d -p "/tmp")" LOG="$(mktemp -p "${WORK_DIR}")" exec > "${LOG}" 2>&1 LOWER1_DIR="$(_sample_data "/etc/default")" LOWER2_DIR="$(_sample_data "/boot/grub")" LOWER3_DIR="$(_sample_data "/etc/apache2")" unset uf lf while read uf; do [ -e "${uf}" ] || \ continue if [ -d "${uf}" ]; then u="${uf}" else u="$(mktemp -d -p "${WORK_DIR}")" mount -o loop "${uf}" "${u}" fi if [ -n "${lf}" ]; then if [ -d "${lf}" ]; then l="${lf}" else l="$(mktemp -d -p "${WORK_DIR}")" mount -o loop "${lf}" "${l}" fi r="$(mktemp -d -p "${WORK_DIR}")" mount -t overlayfs -o ro,lowerdir="${l}",upperdir="${u}" "overlayfs" "${r}" lf="${r}" else lf="${u}" fi done << EOF ${LOWER1_DIR} ${LOWER2_DIR} ${LOWER3_DIR} EOF [ -d "${lf}" ] || \ exit 1 ROOT_DIR="$(mktemp -d -p "${WORK_DIR}")" COW_DIR="$(mktemp -d -p "${WORK_DIR}")" mount -t overlayfs -o rw,lowerdir="${lf}",upperdir="${COW_DIR}" "overlayfs" "${ROOT_DIR}" echo "rootdir: ${ROOT_DIR}" echo "COW: ${COW_DIR}" mount -l #exit 0 _overlayfs_test "${ROOT_DIR}/etc/apache2" _overlayfs_test "${ROOT_DIR}/boot/grub" _overlayfs_test "${ROOT_DIR}/etc/default" umount "${ROOT_DIR}" while read f; do [ -d "${f}" ] && \ mountpoint -q "${f}" && \ umount "${f}" || : done << EOF $(find "${WORK_DIR}" -mindepth 1 -maxdepth 1 -type d) EOF : --Boundary-00=_c9c6Nc0nLcj91CJ--