From owner-freebsd-bugs@FreeBSD.ORG Fri Aug 15 14:00:04 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 5633B106567E for ; Fri, 15 Aug 2008 14:00:04 +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 0EE3F8FC31 for ; Fri, 15 Aug 2008 14:00:04 +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 m7FE03v5034494 for ; Fri, 15 Aug 2008 14:00:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m7FE03R3034487; Fri, 15 Aug 2008 14:00:03 GMT (envelope-from gnats) Resent-Date: Fri, 15 Aug 2008 14:00:03 GMT Resent-Message-Id: <200808151400.m7FE03R3034487@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 E8D37106566C for ; Fri, 15 Aug 2008 13:54:57 +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 C771A8FC08 for ; Fri, 15 Aug 2008 13:54:57 +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 m7FDsv0r009934 for ; Fri, 15 Aug 2008 13:54:57 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m7FDsvvn009921; Fri, 15 Aug 2008 13:54:57 GMT (envelope-from nobody) Message-Id: <200808151354.m7FDsvvn009921@www.freebsd.org> Date: Fri, 15 Aug 2008 13:54:57 GMT From: GW To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/126552: unionfs move directory problem 1 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:00:04 -0000 >Number: 126552 >Category: kern >Synopsis: unionfs move directory problem 1 >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Aug 15 14:00:03 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. >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 Problem appears (lost directory contents): ~/rw# mv orig moved ~/rw# ls -aFloWi total 6 49874 drwx------ 3 root wheel - 512 Aug 12 01:33 ./ 49872 drwx------ 4 root wheel - 512 Aug 12 01:20 ../ 49878 drwx------ 2 root wheel - 512 Aug 12 01:20 moved/ 0 w--------- 0 root wheel - 0 Jan 1 1970 orig% ~/rw# ls -aFloWi moved total 4 49878 drwx------ 2 root wheel - 512 Aug 12 01:20 ./ 49874 drwx------ 3 root wheel - 512 Aug 12 01:33 ../ << WTF!??? PROBLEM 1 And now some magic (content reappears): ~/rw# mv moved orig ~/rw# ls -aFloWi total 6 49874 drwx------ 3 root wheel - 512 Aug 12 01:33 ./ 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:33 ../ 49876 -rw------- 1 root wheel - 0 Aug 12 01:20 file 49877 -rw------- 1 root wheel - 0 Aug 12 01:20 file2 >Fix: I see two possible solutions to this problem 1: - on directory rename/move the whole file hierarchy should be exactly duplicated under a new directory tree - if both layers exist on the same partition, inodes of files can be reused as it is done with hard links, but the directory structure needs to be duplicated so that it has correct parent inodes Any better idea? >Release-Note: >Audit-Trail: >Unformatted: