From owner-freebsd-bugs@FreeBSD.ORG Fri Aug 15 14:10:03 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AB7F1065684 for ; Fri, 15 Aug 2008 14:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 07A6E8FC23 for ; Fri, 15 Aug 2008 14:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m7FEA23i034873 for ; Fri, 15 Aug 2008 14:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m7FEA28E034872; Fri, 15 Aug 2008 14:10:02 GMT (envelope-from gnats) Resent-Date: Fri, 15 Aug 2008 14:10:02 GMT Resent-Message-Id: <200808151410.m7FEA28E034872@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, GW Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8F7D1065673 for ; Fri, 15 Aug 2008 14:01:11 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 879BD8FC1F for ; Fri, 15 Aug 2008 14:01:11 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m7FE1Bcg016576 for ; Fri, 15 Aug 2008 14:01:11 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m7FE1BiS016575; Fri, 15 Aug 2008 14:01:11 GMT (envelope-from nobody) Message-Id: <200808151401.m7FE1BiS016575@www.freebsd.org> Date: Fri, 15 Aug 2008 14:01:11 GMT From: GW To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/126553: unionfs move directory problem 2 (files appear) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Aug 2008 14:10:03 -0000 >Number: 126553 >Category: kern >Synopsis: unionfs move directory problem 2 (files appear) >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Aug 15 14:10:02 UTC 2008 >Closed-Date: >Last-Modified: >Originator: GW >Release: 7.0-STABLE >Organization: Tnode.com >Environment: FreeBSD server.domain.com 7.0-STABLE FreeBSD 7.0-STABLE #5: Sun Aug 10 09:54:42 CEST 2008 root@server.domain.com:/usr/src/sys/amd64/compile/SERVER amd64 >Description: I assume that this is a new bug, because there was no response on the freebsd-fs mailing list. Moving directories around in unionfs mounts isn't handled correctly as can be seen from the long example below. It behaves the same if there is no "-o below" parameter. This one makes files appear. >How-To-Repeat: Create original directory hierarchy: ~# mkdir rw ro ro/orig ~# touch ro/orig/file ro/orig/file2 ~# mount -t unionfs -o below ro rw ~# cd rw ~/rw# ls -aFloWi total 6 49874 drwx------ 3 root wheel - 512 Aug 12 01:32 ./ 49872 drwx------ 4 root wheel - 512 Aug 12 01:20 ../ 49878 drwx------ 2 root wheel - 512 Aug 12 01:20 orig/ ~/rw# ls -aFloWi orig/ total 4 49878 drwx------ 2 root wheel - 512 Aug 12 01:20 ./ 49874 drwx------ 3 root wheel - 512 Aug 12 01:32 ../ 49876 -rw------- 1 root wheel - 0 Aug 12 01:20 file 49877 -rw------- 1 root wheel - 0 Aug 12 01:20 file2 Lets test something (it creates in upper layer): ~/rw# mkdir new ~/rw# touch new/newfile ~/rw# ls -aFloWi total 8 49874 drwx------ 4 root wheel - 512 Aug 12 02:04 ./ 49872 drwx------ 4 root wheel - 512 Aug 12 02:03 ../ 49879 drwx------ 2 root wheel - 512 Aug 12 02:04 new/ 49878 drwx------ 2 root wheel - 512 Aug 12 01:20 orig/ ~/rw# ls -aFloWi new total 4 49879 drwx------ 2 root wheel - 512 Aug 12 02:04 ./ 49874 drwx------ 4 root wheel - 512 Aug 12 02:04 ../ 49880 -rw------- 1 root wheel - 0 Aug 12 02:04 newfile ~/rw# ls -aFloWi orig total 4 49878 drwx------ 2 root wheel - 512 Aug 12 01:20 ./ 49874 drwx------ 4 root wheel - 512 Aug 12 02:04 ../ 49876 -rw------- 1 root wheel - 0 Aug 12 01:20 file 49877 -rw------- 1 root wheel - 0 Aug 12 01:20 file2 And lets see if there is another problem: ~/rw# rm -rf orig ~/rw# ls -aFloWi total 6 49874 drwx------ 3 root wheel - 512 Aug 12 02:06 ./ 49872 drwx------ 4 root wheel - 512 Aug 12 02:03 ../ 49879 drwx------ 2 root wheel - 512 Aug 12 02:06 new/ 0 w--------- 0 root wheel - 0 Jan 1 1970 orig% ~/rw# mv new orig ~/rw# ls -aFloWi total 6 49874 drwx------ 3 root wheel - 512 Aug 12 02:07 ./ 49872 drwx------ 4 root wheel - 512 Aug 12 02:03 ../ 49879 drwx------ 2 root wheel - 512 Aug 12 02:06 orig/ Looks fine till now, but (files appear from nowhere): ~/rw# ls -aFloWi orig total 4 49879 drwx------ 2 root wheel - 512 Aug 12 02:06 ./ 49874 drwx------ 3 root wheel - 512 Aug 12 02:07 ../ 49876 -rw------- 1 root wheel - 0 Aug 12 01:20 file 49877 -rw------- 1 root wheel - 0 Aug 12 01:20 file2 49880 -rw------- 1 root wheel - 0 Aug 12 02:05 newfile << WTF!??? PROBLEM 2 >Fix: For this problem 2 I see solutions: - in all cases (option whiteout=always or whenneeded) when new directories get created unionfs should check whether such a directory exists in the lower layer and automaticly whiteout all of its entries - or better (can not work for more than 2 layers) copying all files to upper layer in the moved directory and set the opaque flag, so that underlying files under the new directory name can't be seen through (with other words set opaque on new directory and copy all files in it) Any better idea? >Release-Note: >Audit-Trail: >Unformatted: