Browsing through fs/nfs/... but this wasn't obvious to me, so: if I try to write while being "above quota", to a file that doesn't belong to me, will I get EPERM or ENOSPC?

Another way to phrase this is: for an inode write, which comes first, the check for permissions, or the check for quota?

  • My gues would be that permission comes first as you need to have permission to know quota status! – George Udosen Mar 27 '18 at 23:19

You can only write to a file after you have opened it. When you open it the permission checks are done. In theory one might argue that for a request for a read-write file descriptor the quota state might be checked but as you need write access to truncate a file and quota should never prevent space from being freed I assume this is not the case.

Thus due to the order of open() and write() the permission check should always come first.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.