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

client: avoid returning negative space available #15481

Merged
merged 1 commit into from Jun 19, 2017
Merged

Conversation

jcsp
Copy link
Contributor

@jcsp jcsp commented Jun 5, 2017

...when a quota is set and the used bytes exceed
the quota.

Fixes: http://tracker.ceph.com/issues/20178
Signed-off-by: John Spray john.spray@redhat.com

@jcsp jcsp added bug-fix cephfs Ceph File System labels Jun 5, 2017
@jcsp jcsp requested a review from batrick June 5, 2017 10:34
const fsblkcnt_t free = total - used;
// It is possible for a quota to be exceeded: arithmetic here must
// handle case where used > total.
const fsblkcnt_t free = MAX(0, total - used);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if fsblkcnt_t is an unsigned type, we might need to cast it to a signed type first.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, amended to do it another way

...when a quota is set and the used bytes exceed
the quota.

Fixes: http://tracker.ceph.com/issues/20178
Signed-off-by: John Spray <john.spray@redhat.com>
@batrick
Copy link
Member

batrick commented Jun 5, 2017

Reviewed-by: Patrick Donnelly <pdonnell@redhat.com>

@jcsp jcsp merged commit 35fcb15 into ceph:master Jun 19, 2017
@jcsp jcsp deleted the wip-20178 branch June 19, 2017 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix cephfs Ceph File System
Projects
None yet
3 participants