[PVFS-users] Re: FileZilla with pvfs

Murali Vilayannur vilayann at mcs.anl.gov
Fri Jun 4 16:26:46 EDT 2004


Hi Rob,

You are right! Attached a patch that fixes the problem with sftp's 
directory listing.
Hope this helps Hsieh.

Thanks
Murali

P.S: The attached test program is a simulation of sftps ls behaviour
Compile it and run as follows

./a.out <any mounted filesystem path> should print exactly 1 directory 
listing. With a PVFS mounted file system you would see 10 duplicate 
directory listings.
With this patch, the test program (and hence the behaviour of sftp)
starts working fine.


On Fri, 4 Jun 2004, Rob Ross wrote:

> It would be interesting to get an strace of the sftp server so that we can 
> see what is going wrong.  Clearly there is something a little off, either 
> an assumption that the sftp server is making about directory read 
> semantics, or something that we haven't gotten quite right.
> 
> Regards,
> 
> Rob
> 
> On Fri, 4 Jun 2004, Nathan Poznick wrote:
> 
> > Thus spake Hsieh Tsan Lung:
> > > 
> > > Under Linux version 2.4.20-28.7smp, it has a command /usr/bin/sftp
> > > [root at cafadmin root]# sftp MY_PC_IP
> > > Connecting to MY_PC_IP...
> > > root at MY_PC_IP's password:
> > > sftp> cd /var/www/html/pvfs
> > > sftp> ls
> > > Once I execute command ls, it will show the list of files and directories.
> > > But this list will not end.
> > > 
> > > What I mean is that this list will be displayed in a loop, No ending.
> > > 
> > > So this is why FileZilla is stoped when it execute ls.
> > 
> > I can confirm that this occurs, however my instinct is that it is not a
> > PVFS issue, but rather some oddity in the way that the sftp server reads
> > a directory listing.  ls, ftp servers, web servers all can get a
> > directory listing on PVFS without being confused, so it seems that sftp
> > is the only thing which can't.
> 
> _______________________________________________
> PVFS-users mailing list
> PVFS-users at www.beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs-users
> 
> 
-------------- next part --------------
diff -Naur pvfs-kernel/dir.c pvfs-kernel-new/dir.c
--- pvfs-kernel/dir.c	2004-01-15 10:07:35.000000000 -0500
+++ pvfs-kernel-new/dir.c	2004-06-04 16:21:20.000000000 -0400
@@ -826,8 +826,10 @@
 				goto out;
 			}
 		}
-		/* ll_pvfs_readdir gives us the position to start from the next time */
-		file->f_pos = pos;
+		/* ll_pvfs_readdir gives us the position to start from the next time if count was != 0 */
+		if (count != 0) {
+			file->f_pos = pos;
+		}
 		
 		/* eof */
 		if(count != FETCH_DENTRY_COUNT) {
-------------- next part --------------
#include <dirent.h>
#include <stdio.h>
#include <sys/types.h>


DIR *dirp;

int func(char *str)
{
	struct dirent *dp;

	if (!str)
		return -1;

	if (dirp == NULL) {
		if ((dirp = opendir(str)) == NULL) {
			perror("open_dir:");
			exit(1);
		}
	}
	while ((dp = readdir(dirp)) != NULL) {
		printf ("%s\n", dp->d_name);
	}
	return 0;
}


int main(int argc, char *argv[])
{
	int i = 0;

	for (i=0; i < 10; i++) {
		func(argv[1]);
	}
	return 0;
}


More information about the PVFS-users mailing list