Bug 172081
Summary: | rename(2) onto an empty directory fails on NFS file systems | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 4 | Reporter: | Chuck Lever <cel> | ||||
Component: | kernel | Assignee: | Neil Horman <nhorman> | ||||
Status: | CLOSED ERRATA | QA Contact: | Brian Brock <bbrock> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 4.0 | CC: | cjones, jbaron | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | RHSA-2006-0132 | Doc Type: | Bug Fix | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2006-03-07 20:36:02 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 168429 | ||||||
Attachments: |
|
Description
Chuck Lever
2005-10-31 00:25:30 UTC
chuck, can you provide the exact command please? This command: rename \/mnt\/ \/mnt\/test\/ /mnt/neil.txt works fine if test is a local directory but return EXDEV if test is NFS mounted. Since you said it returns EBUSY, I'd like to be sure that we're seeing the same problem before I look at the fix. Thanks! hi guys- the problem is with the rename(2) system call. write a test program that creates an arbitrary empty directory in NFS, then uses rename(2) to rename another NFS directory onto it. the expected result is that the empty directory will be replaced. The rename utility directly uses the rename syscall, but to illustrate: ======================================================= #include <stdlib.h> #include <stdio.h> int main(int argc, char **argv) { char *from = argv[1]; char *to = argv[2]; if (rename(from,to)<0) perror("unable to rename"); return 0; } =========================================================== if test is a local directory, this works fine, but if the destination is an nfs mount point: [root@x120-8678-2 mnt]# ./a.out ./neil.txt /mnt/test/neil.txt unable to rename: Invalid cross-device link [root@x120-8678-2 mnt]# uname -a Linux x120-8678-2.gsslab.rdu.redhat.com 2.6.9-22.9.ELsmp #1 SMP Fri Oct 28 18:38:46 EDT 2005 i686 i686 i386 GNU/Linux Given that the man page indicates that EXDEV is the required return code from the use of the rename syscall accross filesystems, this seems to be operating correctly. I can't seem to get it to produce an EBUSY. If you could provide your exact test case, I'd certainly appreciate it. Thanks hi neil- i'm not trying to rename across file systems. 1. create two subdirectories of a directory on an NFS mount. call them subdirectory "A" and subdirectory "B". they both reside in the same parent directory, and thus they are both contained in the same file system. 2. use your program to rename A as B. rename(2) will return EBUSY. Created attachment 120617 [details]
patch to massage upstream commit to RHEL4 kernel
Sorry, Chuck. I've reproduced the problem now, and verified the fix on the
latest RHEL4 kernel.
This fix has been committed in the RHEL4 U3 beta. Action: Netapp, please test and provide feedback to RH ASAP. compared behavior of 2.6.9-1.677 with 2.6.9.27-EL via a test program. bad behavior reproduced on 677, but behavior now appears to be correct on EL kernel. An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2006-0132.html |