OSXFUSE openFileAtPath and rsync

258 views
Skip to first unread message

Alessandro Diaferia

unread,
Oct 17, 2011, 11:48:09 AM10/17/11
to osxfus...@googlegroups.com
Hi, I'm developing a backup facility that takes advantage of rsync behind the scenes. In addition to this, not every file you see in the volume is actually there, locally, but might be hosted remotely only. When the user wants to download a remote file an rsync process is fired to start the download. The drawback for this is that actually the whole rsync download occurs in the openFileAtPath method. This way there's no visual feedback to the user regarding the current progress. In addition to this it may occur, especially with slow connections, that OSXFUSE stops to work while the download is in progress. Is this an OSXFUSE-related issue or is it something lower? In either cases, do you have any hint on how to address this?

Thank you in advance for your time.
Kind regards.

Benjamin Fleischer

unread,
Oct 17, 2011, 1:01:23 PM10/17/11
to osxfus...@googlegroups.com
Hi Alessandro,

are you running into the 60 seconds timeout after which your filesystem is forcibly ejected? If this is the case, you could take a look at other network file systems like YouTubeFS, sshfs or curlftpfs. Most likely the have to deal with the same problem. Maybe you could solve this problem by running downloads in a separate threads. Your main thread would stay responsive.

It should be possible to display the progress of the download in a window similar to Finder's "Copy" progress window. In the end your file system is a regular Mac OS X application. In addition to that you could overlay the the icon of the file, that is being downloaded, with a progress bar like Safari does for downloads. This of cause won't help with an application, that is unresponsive until the file is downloaded and available locally.

Regards,
Benjamin

Alessandro Diaferia

unread,
Oct 17, 2011, 1:07:50 PM10/17/11
to osxfus...@googlegroups.com
Thank you for your hint.
I would like to go with a different thread for download too but my concern is about the sequence open->read->close. If I launch the download thread in the openFileAtPath method and return immediately, wouldn't it go with a readFileAtPath subsequently? By that time the file could still be downloading and not ready for read. Am I misunderstanding the whole thing?

I'd go through YouTubeFS and sshfs code in the meantime :)

Benjamin Fleischer

unread,
Oct 17, 2011, 1:19:34 PM10/17/11
to osxfus...@googlegroups.com
Scratch my comment about YourTubeFS. The version in OSXFUSE's filesystem repository just creates "links" to the videos. The videos are not downloaded. Some time ago I came across a file system that actually downloaded videos, but I can't seem to remember its name.

Alessandro Diaferia

unread,
Oct 18, 2011, 3:48:37 AM10/18/11
to osxfus...@googlegroups.com
Yup, and sshfs takes advantage of sftp to read files remotely without actually download them. I need to download files instead.

Alessandro Diaferia

unread,
Oct 18, 2011, 4:02:40 AM10/18/11
to osxfus...@googlegroups.com
Would it be a "correct" approach to fire a detached thread to download the file and return EAGAIN error in subsequent read as long as the file is still downloading? I'd like to prevent Finder error messages from appearing while the file is downloading.

Sam Moffatt

unread,
Oct 19, 2011, 2:25:37 AM10/19/11
to osxfus...@googlegroups.com
If it is opened in a non-blocking mode then EAGAIN would be reasonable
however if it is marked as blocking then block until you have the data
requested. I'm not entirely familiar with the Obj-C interface however
only the C one so there may be an implementation difference.

Cheers,

Sam Moffatt
http://pasamio.id.au

ramesh

unread,
Apr 15, 2014, 8:12:14 AM4/15/14
to osxfus...@googlegroups.com
I am developing a FUSE file system and even I have come across the same problem now. Could you resolve this issue in any way without affecting the user experience?

free.d...@gmail.com

unread,
Mar 30, 2017, 4:47:00 AM3/30/17
to OSXFUSE
Hi Guys,
So, did EAGAIN works for anyone?

I used EAGAIN in OpenFileAtPath and ReadFileAtPath - i don't see any difference. 

вторник, 15 апреля 2014 г., 15:12:14 UTC+3 пользователь ramesh написал:

Sam Moffatt

unread,
Mar 31, 2017, 12:05:23 AM3/31/17
to osxfus...@googlegroups.com
You mean when you return EAGAIN in your FS, the original caller doesn’t get the EAGAIN? What error does the caller get?

--
You received this message because you are subscribed to the Google Groups "OSXFUSE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osxfuse-group+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Roman Sidorakin

unread,
Jul 17, 2017, 9:39:27 AM7/17/17
to OSXFUSE

Hi, guys.
I faced with the similar problem. I need to stop (pause) read calls, until file will be downloaded from cloud.
So, currently i'm pausing thread inside readFileAtPath call. But it causes freezing UI of Finder, in case if i am trying to open context menu of this file. Also, if i have an image opened in Preview.app, and downloading of other image in progress (read call paused), then UI of Preview.app also freezes until readFileAtPath calls will be resumed.

Can you please explain a little more about EAGAIN and O_NONBLOCK?
Currently i have tried to return EAGAIN from readFileAtPath method if file not downloaded, but from the logs i'm seeing, that readFileAtPath returns EAGAIN about 2-3 times, and then i see error, that file can't be opened.

I will be happy for any answer, even related to C-based api.
Thanks.

пятница, 31 марта 2017 г., 7:05:23 UTC+3 пользователь Samuel Moffatt написал:
To unsubscribe from this group and stop receiving emails from it, send an email to osxfuse-grou...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages