Skip to content
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

Mounting several external storages over the same mount point causes the "old" storages to get overwritten #10511

Closed
jvillafanez opened this issue Aug 19, 2014 · 66 comments

Comments

@jvillafanez
Copy link
Member

jvillafanez commented Aug 19, 2014

Steps to reproduce

  1. Mount a external storage in folder "F1"
  2. Mount another external storage in the same folder "F1"
  3. The first external storage won't be accessible because the "F1" folder will access to the last external storage

Note: the same happens if a local folder "F1" is already created and an external storage is mounted there

Expected behaviour

Either core throws an error telling that it's not possible to mount the external storage in that location (so the app can handle this error by its own) or core rename the mount automatically

Actual behaviour

The last external storage overwrites the other storages making them inaccessible

@MTRichards

@PVince81
Copy link
Contributor

CC @Xenopathic if you're interested

The easiest way would be to show an error.

@MTRichards
Copy link
Contributor

Can we do this in core, so that only 1 mount point can be mounted with a given name?
@craigpg @karlitschek

@PVince81
Copy link
Contributor

@schiesbn @icewind1991 can the logic from the server to server sharing be reused someone to avoid duplicate mount points ?

@icewind1991
Copy link
Contributor

server<->server sharing re-uses the logic from file upload to generate unique names

@MTRichards
Copy link
Contributor

@jvillafanez
Can we reuse that then, and not fail to mount, but increment the name ((1), (2), etc) so duplicates are not created?

@jvillafanez
Copy link
Member Author

As long as we can detect the name collision, there is no problem.

However, I'm not sure who (or what component) should be responsible to detect that name collision (the core or each app using external storage)
I think the core should be responsible to detect this, either by renaming the mount (with whatever logic) or by refusing to mount the storage (throwing an exception at the time to mount the storage, and let each app handle it).

If each app is responsible to detect the collision, first of all, every app (using external storage) MUST implement code to detect the collision, otherwise we won't solve anything because a "failing" app can still override the mount point.
And the second point, is that I'm not sure whether the app should have any knowledge about the whole ownCloud FS. It should just be "I want to mount this storage here". If ownCloud reject it because the target folder exists then the app can try to mount the storage in other place, or take other kind of action

@PVince81
Copy link
Contributor

The code for collision detection could be called from the OC_Mount_Config class (in files_external/lib/config.php), maybe at the time when the mount point is saved. It would automatically save it with an alternative name and somehow needs to notify the called / the UI about it.
It might be easier to detect the collision and just throw an error...

@rperezb
Copy link

rperezb commented Aug 19, 2014

Could it be possible to detect the collision from the core and throw an error?
The key thing is that if any app using the external storage does not add the detection, it may overwritte other mountpoint.

@RobinMcCorkell
Copy link
Member

I think this is a duplicate of #8174 - in which case I'm working on a (possible) solution. It's just more difficult than I anticipated, and I might have to convert the whole client-side representation of the mount points from the current DOM model to a full JS object model

@PVince81
Copy link
Contributor

@Xenopathic why do you need to convert the JS part ? Is it to be able to find out whether the server changed the mount point ? Or are you trying to detect collisions on the JS side ?

Trouble is that collisions can also happen when mounting onto existing folders, I'm not sure whether we want to allow this.
And another case is when a personal mount is mounted on top of a system mount.

If automatically renaming is too complicated then let's go with the "throw an exception" route.

Can you submit a WIP PR where we could assist you somehow ?

@PVince81
Copy link
Contributor

Also note that a mount point name in the UI can be set to a subdirectory like "/mounts/myawesomemount" which might complicate it even more Just in case you guys weren't aware of such cases 😄

@RobinMcCorkell
Copy link
Member

@PVince81 I was thinking it through today, I might be able to get away with shunting the data into the DOM model. There needs to be a balance between compactness (DOM model) and code readability (JS object), but hopefully I'll get it right. Collisions between mount points should be detected on the client side.

@MTRichards MTRichards added this to the 2014-sprint-04-next milestone Sep 5, 2014
@MTRichards MTRichards modified the milestones: 2014-sprint-03-current, 2014-sprint-04-next Sep 5, 2014
@PVince81
Copy link
Contributor

PVince81 commented Sep 5, 2014

@Xenopathic any update on your second part of the fix, the one with validation ?
No need to over-engineer it for now as it's needed soon. 😄

@PVince81
Copy link
Contributor

PVince81 commented Sep 5, 2014

Note: if your fix for mount point duplication detection is based on #10428 we'll need to backport that as well...

@PVince81
Copy link
Contributor

PVince81 commented Sep 9, 2014

@Xenopathic if you don't have time to fix it, could you at least push your remaining commits on a branch so someone else could finalize it ?

@RobinMcCorkell
Copy link
Member

@PVince81 Wow, I was meaning to reply to this when I got the notification 4 days ago but completely forgot... I do have the commits on a local branch, but there isn't anything substantial there and they would need to be rewritten anyway. I think the core devs need to get together and discuss a proper exception heirarchy and framework before commits of that kind can be merged proper.

@PVince81
Copy link
Contributor

PVince81 commented Sep 9, 2014

Ok, understood.
We'd still need a quicker fix for the mountpoint conflict validation for 7.0.3, so there is not much time for longer discussion about exception handling.

Let us know whether you'd like to try implementing it or whether someone else should do it 😄

@craigpg craigpg added this to the 2014-sprint-04-current milestone Sep 15, 2014
@ghost
Copy link

ghost commented Mar 25, 2016

@PVince81 @MTRichards moving this to 9.1 as we look into files_external then?

@MTRichards MTRichards modified the milestones: 9.1-current, 9.0.1-current-maintenance Mar 25, 2016
@MTRichards
Copy link
Contributor

Yes. Seems to solve a problem, and may be wise to work it into files external since we are consolidating there for consistent handling of issues.

@PVince81
Copy link
Contributor

Yeah. I hope we can make some more changes/additions under the hood to make such check possible (oc_mounts table)

@PVince81 PVince81 modified the milestones: 9.1-current, 9.1.1-next-maintenance Jun 30, 2016
@PVince81 PVince81 modified the milestones: 9.1.2, 9.1.1 Sep 21, 2016
@PVince81 PVince81 modified the milestones: 9.1.3, 9.1.2 Oct 20, 2016
@PVince81 PVince81 removed the triage label Nov 16, 2016
@PVince81 PVince81 modified the milestones: 9.1.4, 9.1.3 Nov 30, 2016
@PVince81
Copy link
Contributor

PVince81 commented Feb 6, 2017

Moving to backlog.

The potential solution is overly complex due to not fitting architecture and this issue doesn't seem to be a major blocker for any one so far.

Ideally we should rework the FS mount system as described in #26190 which would make it possible to catch conflicts in a central place.

@ownclouders
Copy link
Contributor

Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

(This is an automated comment from GitMate.io.)

@PVince81
Copy link
Contributor

Leaving closed. Requires proper mount manager. See #26190

@lock
Copy link

lock bot commented Jul 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests