Skip to content

Encryption + quota file truncation risk when reaching quota #7626

Closed

Description

@PVince81

Steps to reproduce:

  1. Enable encryption.
  2. Set a quota of 250 kb.
  3. Upload two files with 100 kb.

Expected result

File is uploaded correctly

Actual result

The second 100kb file is truncated (and encrypted)

Versions

ownCloud 7 pre-alpha (and potentially 6.0.2 as well)

More info

Encrypted files are generally a bit bigger than original files, but the quota calculation is based on unencrypted sizes, which causes confusion and makes the quota wrapper truncate the file too early.

I've discussed this with @schiesbn and we agreed to go with a soft quota. Actually, we've already decided for having a soft quota before because of metadata and other files that do not count into it.

However, the quota stream implementation is still enforcing a hard quota (truncates the last bytes that exceed the quota), and it is tricky to make it work properly in situations where multiple files are uploaded from different sources at the same time and different speeds (race conditions).

We will thus remove the hard limit, which might also mean removing the quota stream wrapper completely as its sole purpose seems to be to enforce that hard limit.

Additionally, as per #7589 it will be possible to also count external storages in the used space, which means that the potential concurrency and file truncation will become even more incontrollable.

I will prepare a PR to remove the hard limit.

CC @icewind1991

Activity

  1. PVince81 commented on Mar 7, 2014

    @PVince81
    ContributorAuthor

    @karlitschek @icewind1991 are you ok with this ? (you'll get another chance to give feedback in the PR 😉 )

  2. PVince81 commented on Nov 26, 2014

    @PVince81
    ContributorAuthor

    I guess the strategy here is to encourage people to use quotas instead of running against the remaining real disk space. So even if I have the data dir on a 100 GB partition, I should set a 90 GB quota as the 10 GB might be required for metadata and such.
    It is not recommended to give OC a chance to run against disk limits.

    Here are some ideas how the metadata part could be improved: #11963

    I'll keep this ticket here open to document the issue for now.

  3. PVince81 commented on Nov 26, 2014

    @PVince81
    ContributorAuthor

    Hmmm... now by re-reading the issue it seems this happened when a quota was indeed set, and that quota is hard due to the stream wrapper.

  4. MorrisJobke commented on Aug 12, 2015

    @MorrisJobke
    Contributor

    @PVince81 @schiesbn Is this still valid with the new encryption?

  5. PVince81 commented on Aug 13, 2015

    @PVince81
    ContributorAuthor

    Not sure, might depend on the stream wrapper order

  6. MorrisJobke commented on Aug 17, 2015

    @MorrisJobke
    Contributor

    This still happens when trying this with a file that filled 240/250kB.

  7. added this to the backlog milestone on Mar 1, 2016
  8. PVince81 commented on Aug 15, 2016

    @PVince81
    ContributorAuthor

    Let's throw away the quota stream wrapper anyway at the next opportunity, probably 9.2.

  9. modified the milestones: , backlog on Aug 15, 2016
  10. self-assigned this
    on Jan 13, 2017
  11. modified the milestones: backlog, 10.0 on Apr 6, 2017
  12. removed their assignment
    on Jun 26, 2017
  13. ownclouders commented on Jan 13, 2018

    @ownclouders
    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.)

  14. lock commented on Jul 31, 2019

    @lock

    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.

  15. locked as resolved and limited conversation to collaborators on Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions