diff mbox

[v2] overlay: notrun if upper fs does not support d_type

Message ID 1461316911-17533-1-git-send-email-xzhou@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Murphy Zhou April 22, 2016, 9:21 a.m. UTC
Overlayfs whiteout can be visible if underlying upper fs does not
support d_type. Kernel commit
	45aebea (ovl: Ensure upper filesystem supports d_type)
prevents mounting overlayfs like this since v4.6-rc1.

Check upper fs before mounting overlay, mark as not run if needs.

Signed-off-by: Xiong Zhou <xzhou@redhat.com>
---

v2: use case to make this less ugly..


 common/rc | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Eryu Guan April 22, 2016, 10:24 a.m. UTC | #1
On Fri, Apr 22, 2016 at 05:21:51PM +0800, Xiong Zhou wrote:
> Overlayfs whiteout can be visible if underlying upper fs does not
> support d_type. Kernel commit
> 	45aebea (ovl: Ensure upper filesystem supports d_type)
> prevents mounting overlayfs like this since v4.6-rc1.
> 
> Check upper fs before mounting overlay, mark as not run if needs.
> 
> Signed-off-by: Xiong Zhou <xzhou@redhat.com>

I'm not sure if this really necessary, but looks fine to me.

Reviewed-by: Eryu Guan <eguan@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/common/rc b/common/rc
index 8bec836..946b354 100644
--- a/common/rc
+++ b/common/rc
@@ -273,6 +273,22 @@  _overlay_mount()
 	local dir=$1
 	local mnt=$2
 	shift 2
+
+	local upper_fst=$(df --output=fstype $dir | tail -1)
+	case "$upper_fst" in
+	xfs)
+		if ! xfs_info $dir | grep -q "ftype=1" ; then
+			_notrun "upper fs needs to support d_type"
+		fi
+		;;
+	ext2|ext3|ext4)
+		if ! tune2fs -l $(df --output=source $dir | tail -1) | \
+		   grep -q filetype ; then
+			_notrun "upper fs needs to support d_type"
+		fi
+		;;
+	esac
+
 	mkdir -p $dir/$OVERLAY_UPPER_DIR
 	mkdir -p $dir/$OVERLAY_LOWER_DIR
 	mkdir -p $dir/$OVERLAY_WORK_DIR