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...
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel   
(Show other bugs)
Version: 6.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Michael K. Johnson
QA Contact:
Depends On:
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:
Story Points: ---
Clone Of:
Last Closed: 1999-09-24 20:30:10 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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]);
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%
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.