* Case sensitivity in NFS files
@ 2008-10-09 16:39 Michal Sojka
[not found] ` <200810091839.49445.sojkam1-jQs2MHkdoM/twjQa/ONI9g@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Michal Sojka @ 2008-10-09 16:39 UTC (permalink / raw)
To: linux-nfs
Hello,
I'm experiencing strange problem with case sensitivity of files on NFS3
filesystem. I want to backup my server to a NAS device. The server is:
Linux rtime 2.6.25-gentoo-r8 #6 SMP Thu Oct 9 13:00:08 CEST 2008 i686
and NAS is:
Linux RtimeBackup 2.6.15 #722 Fri Sep 19 20:23:15 CST 2008 armv5tejl unknown
I would like to use rdiff-backup tool, which checks for case sensitivity of
the target filesystem. The technique it uses to check this is the same as in
this file:
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
int fd;
struct stat st;
fd = open("A", O_WRONLY|O_CREAT|O_TRUNC, 0666);
perror("1. open(A)"); errno=0;
if (fd == -1) {
exit(1);
}
close(fd);
lstat("A", &st);
perror("2. lstat(A)"); errno=0;
lstat("a", &st);
perror("3. lstat(a)"); errno=0;
unlink("a");
perror("4. unlink(a)"); errno=0;
lstat("A", &st);
perror("5. lstat(A)"); errno=0;
lstat("a", &st);
perror("6. lstat(a)"); errno=0;
}
The expected output of this program is:
1. open(A): Success
2. lstat(A): Success
3. lstat(a): No such file or directory
4. unlink(a): No such file or directory
5. lstat(A): Success
6. lstat(a): No such file or directory
On NFS, I sometimes get the following (neither "A" nor "a" files existed
before execution):
1. open(A): Success
2. lstat(A): Success
3. lstat(a): Success
4. unlink(a): Success
5. lstat(A): Stale NFS file handle
6. lstat(a): No such file or directory
This happens when the program is run for the first time. When I run it for the
second time, I get the expected output and file "A" is created. After I
remove the A file, I get the "wrong" output again.
Does anybody know, what is causing this behavior?
Thanks
Michal
P.S.: Please CC me when replying.
^ permalink raw reply [flat|nested] 3+ messages in thread[parent not found: <200810091839.49445.sojkam1-jQs2MHkdoM/twjQa/ONI9g@public.gmane.org>]
* Re: Case sensitivity in NFS files [not found] ` <200810091839.49445.sojkam1-jQs2MHkdoM/twjQa/ONI9g@public.gmane.org> @ 2008-10-09 18:36 ` J. Bruce Fields 2008-10-10 6:38 ` Michal Sojka 0 siblings, 1 reply; 3+ messages in thread From: J. Bruce Fields @ 2008-10-09 18:36 UTC (permalink / raw) To: Michal Sojka; +Cc: linux-nfs On Thu, Oct 09, 2008 at 06:39:49PM +0200, Michal Sojka wrote: > I'm experiencing strange problem with case sensitivity of files on NFS3 > filesystem. I want to backup my server to a NAS device. The server is: > Linux rtime 2.6.25-gentoo-r8 #6 SMP Thu Oct 9 13:00:08 CEST 2008 i686 > and NAS is: > Linux RtimeBackup 2.6.15 #722 Fri Sep 19 20:23:15 CST 2008 armv5tejl unknown Do you know which filesystem it exports? I haven't played with exports of case-insensitive filesystems, but the behavior you saw would seem consistent with that: > On NFS, I sometimes get the following (neither "A" nor "a" files existed > before execution): > > 1. open(A): Success > 2. lstat(A): Success > 3. lstat(a): Success So we looked up "a" on the filesystem, and it found "A", since it considers the two names the same. > 4. unlink(a): Success And the unlink worked too. > 5. lstat(A): Stale NFS file handle But we don't know that it resulted in deleting "A", so we send this stat with the old filehandle and find the file's gone.... > 6. lstat(a): No such file or directory > > This happens when the program is run for the first time. When I run it for the > second time, I get the expected output and file "A" is created. The second time it's probably cached the non-existance of "a", so just returns -ENOENT on lstat(a) instead of asking the server about it. --b. > After I > remove the A file, I get the "wrong" output again. > > Does anybody know, what is causing this behavior? > > Thanks > Michal > > P.S.: Please CC me when replying. > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Case sensitivity in NFS files 2008-10-09 18:36 ` J. Bruce Fields @ 2008-10-10 6:38 ` Michal Sojka 0 siblings, 0 replies; 3+ messages in thread From: Michal Sojka @ 2008-10-10 6:38 UTC (permalink / raw) To: J. Bruce Fields; +Cc: linux-nfs On Thursday 09 of October 2008 20:36:18 J. Bruce Fields wrote: > Do you know which filesystem it exports? I haven't played with exports > of case-insensitive filesystems, but the behavior you saw would seem > consistent with that: Thanks for your reply. Now I see you are right. The exported filesystem is ext3, so I expected it to be case sensitive, but if I check its behavior form the shell on NAS machine it behaves as case insensitive. Probably there is some patched kernel in the NAS machine. Unfortunately I do not have kernel sources, as they ship them only for $20 on CD by snail mail. So this explains the observed behavior. Thanks again. Michal S. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-10-10 6:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-09 16:39 Case sensitivity in NFS files Michal Sojka
[not found] ` <200810091839.49445.sojkam1-jQs2MHkdoM/twjQa/ONI9g@public.gmane.org>
2008-10-09 18:36 ` J. Bruce Fields
2008-10-10 6:38 ` Michal Sojka
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox