-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File system notification support / improved copy speed #32
Comments
Original issue reported on code.google.com by |
[1] http://fuse.996288.n3.nabble.com/Current-state-of-the-art-with-inotify-like-functionality-td9262.html Original issue reported on code.google.com by |
Original issue reported on code.google.com by |
Original issue reported on code.google.com by
|
Original issue reported on code.google.com by |
Original issue reported on code.google.com by |
Original issue reported on code.google.com by |
There is a patch for FUSE currently being reviewed that aims for performing read/write transparent to the user-space implementation. When/if that patch is applied (together with a new version of libfuse) and read/write can be handled separately and inotify watches on the FUSE mount point will still work as expected it could be used by rar2fs to resolve this issue. Lets see. |
Any news on this? Do you have a link where I can follow the status of the fuse patch? |
The kernel patch you can check here I am not sure when and where to get information about the FUSE library API that also needs to be updated for this to work. You might try the FUSE developer mailing archive. |
I've run into the same issue myself and came up with a workaround: I created a dynamic library which implements the inotify_add_watch system call. I start the application, in this case Plex, with the |
Interesting! |
Yes.
This second part of the question makes me wonder if I misunderstand what's possible to do with rar2fs. I had the impression that rar2fs mounted the file system as read only. Or at least that new rar files needed to be added/written to the source directory. |
Nope, rar2fs is a pass-through file-system that can easily be mounted read/write. In fact, with the new folder cache I am not sure your solution would work? What you can do is to touch a file in the corresponding mount point folder after all files are written to the source folder. |
Hmm, I see. That's a couple of days work wasted for nothing. But it was a fun exercise. Perhaps it could be useful for some other scenario. |
Yes, you are on to something good here! The actual problem this issue is all about is the fact that writing to the rar2fs mount point forces all writes to enter the user space application. |
What you have solved is half of the problem, letting the observer watching a mount point see changes made to the souce folder. Now all that is needed is to be able to tell rar2fs this happend some how, preferably carrying information exactly which folder was changed. |
Can't rar2fs use |
Yes, it could but there is a reason (actually several) it does not. But I have an idea, give it a few minutes of thought. |
Ok, I see.
Yeah, I was thinking the same thing. But wouldn't it be easier to modify rar2fs to directly receive notifications from the library? The only reason I used the This would also make the implementation a bit messy. The |
To move a RAR file out of the directory, it needs to be moved out of the source directory, correct? In that case, that's another use case which the |
If we should add notification support it must be portable and handled in a platform independent way.
That is why I would rather not add notification support internally in rar2fs but instead export a simple function for independent implementations to call.
Btw, you would not use read to watch file descriptors. You use a dedicated thread and select()/epoll() that can monitor multiple descriptors.
|
I tried adding a RAR file to the mounted directory. For some reason Plex doesn't pick it up. I tried debugging with my library, only logging enabled. For some reason |
Note that for inotify to work you need to restart PMS whenever you unmount and then remount the rar2fs that is being watched.
|
I see.
So the library would use a traditional |
What the library is doing today is only changing the path passed to |
Are we sure this is a rar2fs issue? I do not seem to see what you see :( |
If I unmount rar2fs and add the same directory, with the regular file, to the same directory as I use for the mount point it works. If I monitor the same directory with If I mount rar2fs as the plex user, both inotifywait and Plex works as expected. Could there be some issue with the |
I also connect over samba with allow_other. No problems there. But I mount as root, maybe that is the difference? Try to use the uid mount option to set it to the PLEX user.
Regarding the library, yes I assume you do not set any notifications yourself. The whole point is that PLEX or whatever application is used should do that. But in the same way as you modify the path you should also be able to "steal" the callback and then notify both the application and rar2fs.
|
I'll give that a try.
That's what I initially was thinking, but then you mentioned threads and |
Ok, then we are both in the same game :)
The select/epoll does not read, it allows you to block on multiple file descriptors, read can only block on one. I think when I mentioned this it was more about how the server lib talks to multiple client libs.
|
Yes, setting the quid to the Plex user works. But that means it changes the owner of the mount point, which means I cannot add content with my regular user (unless using |
Maybe it is the group/gid? rar2fs has nothing to do with permissions really. If this is a problem on exporting the file system, then it is rather something with FUSE. What you can try is to patch rar2fs.c and remove the automatic use of option default_permissions (just search the code for one instance of it). See if that makes a difference or not. Change
to
|
Yeah, that works. |
Ok, need to figure out if that is a good solution or not. May have other implications. |
Can you try to apply this patch to latest master
Try both with and without default permissions. |
With that patch, It works if I remove |
Ok, then the patch has no purpose. That is news of sorts. |
Ok, default permissions option is gone, see 6212575 |
👍 |
Any new thoughts on a possible solution for this? edit: Some related links Seems like there's support for some kind of notification since fuse protocol 7.18 |
No, not really. What is the status on the kernel and user-space patches? If these patches work as intended no modifications should be needed to rar2fs. It only needs to be given the pass through mount options. But it means a new fuse kernel driver (ie rebuild of the kernel or module) and an updated user-space library.
|
Please correct me if I am wrong here, but this has never been about file system notification, or? |
My interest in the issue was coming from a place of me needing file system notifications to be triggered on a rar2fs mount whenever a file was added to the source. I mount Whenever new media is downloaded it's moved into the source folder, this all happens in another container, I wan't plex to pick up the changes. |
@zimme ok, and copying stuff to the mount point (even though a bit slow) is not an option? |
Not really as the mount point only lives inside the docker container that runs plex. This was made possible when docker added support for CAP_SYS_ADMIN.
So it's only my plex container which has access to However this isn't a "BIG" problem for me as I've just set plex to refresh a few times every hour. |
I think this thread ran off-track a long time ago ;) |
I'll have to look into I'll have to read up a bit more on fuse and fsnotify, becuase I got the sense that it's trying to solve the problem I'm looking to get solved. Anyways, thanks for all your work on this awesome project, it saves me a ton of space 😄 |
@zimme if I understand your problem correctly, I think the simplest solution would be to mount an empty directory using Docker and then mount rar2fs on that directory inside the container. That should give you access to both the source and the mount point outside of the container. |
@doobnet Thanks, I'll look into that 👍 |
I am going to close this one. |
My main purpose for trying out rar2fs is to be enjoy media without the need of unpacking it. I would mount a whole directory full of archives and media into rar2fs and see it as a DLNA server's root folder.
This works perfectly, however any new media put into the folder is not picked up by the DLNA sever. The folder is watched with inotify. I need to rebuild the media database manually every time there is a change.
I have looked into the issue as to the reason and fuse does not and will not support forwarding notifications on the src to the mounted target directory. This is understandable as the mount does not need to be on a local filesystem.
So we are left with setting a watch on the mount and directly moving files there instead of the src. This also works... however moving files there is painstakingly slow as we do a copy instead of a mv I presume. Is there any way of speeding things up if a file move is from the same localdisk to the same localdisk? Or is this out of our hands and a fuse thing?
Thanks
Original issue reported on code.google.com by
fafarago
on 2014-03-07The text was updated successfully, but these errors were encountered: