Project

General

Profile

Actions

Bug #21419

closed

client: is ceph_caps_for_mode correct for r/o opens?

Added by Jeff Layton over 6 years ago. Updated over 6 years ago.

Status:
Rejected
Priority:
Low
Assignee:
Category:
-
Target version:
-
% Done:

0%

Source:
Development
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
Client
Labels (FS):
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Greg was reviewing my delegation patches and noticed that we really aren't getting enough caps for read delegations. The initial version of that code uses ceph_caps_for_mode, which does this:

        if (mode & CEPH_FILE_MODE_RD)
                caps |= CEPH_CAP_FILE_SHARED |
                        CEPH_CAP_FILE_RD | CEPH_CAP_FILE_CACHE;
        if (mode & CEPH_FILE_MODE_WR)
                caps |= CEPH_CAP_FILE_EXCL |
                        CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER |
                        CEPH_CAP_AUTH_SHARED | CEPH_CAP_AUTH_EXCL |
                        CEPH_CAP_XATTR_SHARED | CEPH_CAP_XATTR_EXCL;

_open will allow the open to be satisfied from the cache if you have all of the caps for the mode.

Now, suppose we open a file r/o (maybe as one user), someone changes the mode on another host (such that a subsequent r/o open should fail), and then we issue another open against it. I think that will be broken in the current code.

Is seems like r/o opens should request As (and probably Xs), and we shouldn't satisfy opens from the cache unless we have As caps (+Xs if there are ACLs).

I'll see if I can come up with a testcase.

Actions

Also available in: Atom PDF