NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/41678: unionfs doesn't copy a file from the lower layer to the upper layer on rename(), it just fails



>Number:         41678
>Category:       kern
>Synopsis:       unionfs doesn't copy a file from the lower layer to the upper 
>layer on rename(), it just fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 07 10:50:01 +0000 2009
>Originator:     Matthew Sporleder
>Release:        5
>Organization:
>Environment:
NetBSD fester 5.0 NetBSD 5.0 (GENERIC) #0: Sun Apr 26 18:50:08 UTC 2009  
builds%b6.netbsd.org@localhost:/home/builds/ab/netbsd-5-0-RELEASE/i386/200904260229Z-obj/home/builds/ab/netbsd-5-0-RELEASE/src/sys/arch/i386/compile/GENERIC
 i386
>Description:
unionfs doesn't support rename on a file originating in the lower layer
>How-To-Repeat:
/* ren.c */
#include <stdio.h>

int main (int argc, char *argv[])
{
       int ret;
       ret = rename(argv[1], argv[2]);
       ret == 0 ? : perror( "rename failed" );
       return(ret);
}

gcc -o /var/tmp/ren ren.c

mkdir /var/upper
mkdir /var/lower
touch /var/upper/willpass
touch /var/lower/willfail
mount -t union /var/upper /var/lower

(results so far)
<above>:/var/upper       832508     758010      51823  93% /var/lower
fester# ls -l /var/lower
total 0
-rw-r--r--  1 root  wheel  0 Jul  6 22:21 willfail
-rw-r--r--  1 root  wheel  0 Jul  6 22:21 willpass

... (back to the action)
/var/tmp/ren willpass pass
/var/tmp/ren willfail fail
rename failed: Cross-device link

(final results)
fester# ls -l /var/lower
total 0
-rw-r--r--  1 root  wheel  0 Jul  6 22:21 pass
-rw-r--r--  1 root  wheel  0 Jul  6 22:21 willfail

I guess when a rename is passed to the lower layer it should be turned
into a copy at the upper layer and then a rename.

Sorry this isn't in atf,
Matt
>Fix:



Home | Main Index | Thread Index | Old Index