Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 5030 - nfs client: rename with identical old and new name removes files on server, linux staroffice cannot be installed on an nfs server
Summary: nfs client: rename with identical old and new name removes files on server, l...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 6.0
Hardware: i386
OS: Linux
high
high
Target Milestone: ---
Assignee: Michael K. Johnson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-09-09 18:55 UTC by jk
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-09-24 20:30:10 UTC


Attachments (Terms of Use)

Description jk 1999-09-09 18:55:45 UTC
A rename(2) system call with identical old and new name
removes the file on an NFS filesystem (mounted from a
solaris 7 nfs server).  This does not happen, when the
file is located on a local filesystem - on a local
filesystem, such a rename system call is simply a no-op.


15% cat r.c
#include <errno.h>

main(int argc, char **argv)
{
        errno = 0;
        rename(argv[1], argv[1]);
        perror("rename");
}
16% cc -o r r.c

On a local extfs filesystem, a rename with identical old
and new filename is a no-op:

17% touch bla
18% df bla
Filesystem           1k-blocks      Used Available Use%
Mounted on
/dev/hda2               497699    407223     64772  86% /
elise 19% ./r bla
rename: Success
20% ls -l bla
-rw-r--r--   1 jk       games           0 Sep  9 12:42 bla
(rename was successful, file still exists - as expected)


The same rename system call using a file located on a
(solaris 7) nfs server removes the file:

21% touch /home/leo/tmp/bla
22% df /home/leo/tmp/bla
Filesystem           1k-blocks      Used Available Use%
Mounted on
leo:/files/leo        14109271  11257603   2146205  84%
/home/leo
23% ./r /home/leo/tmp/bla
rename: Success
24% ls -l /home/leo/tmp/bla
ls: /home/leo/tmp/bla: No such file or directory
(rename was successful, too but the file is gone!)


[ This bug occurs during an installation of the linux
staroffice suite into a directory located on a (solaris)
nfs server.  The resulting staroffice installation does
not work because almost all file have been deleted
due to this bug on the nfs server !! ]


------- Additional Comments From   09/24/99 16:29 -------
Fixed in later kernels.  2.2.12 does not have the bug.

Back-porting the fix to 2.2.5 for 5.2 and 6.0 errata looks trivial.

------- Additional Comments From   09/24/99 16:34 -------
[Previous comment from Stephen Tweedie <sct@redhat.com>, btw.
 Bugzilla isn't playing nice about labelling the comments...]


Note You need to log in before you can comment on or make changes to this bug.