mirror of
https://github.com/ceph/ceph
synced 2024-12-18 01:16:55 +00:00
Merge pull request #12897 from renhwztetecs/renhw-wip-client-cleanup
client: priority to verify the correctness of the "flag" Reviewed-by: John Spray <john.spray@redhat.com>
This commit is contained in:
commit
64eae76fbe
@ -8138,17 +8138,17 @@ void Client::_put_fh(Fh *f)
|
||||
int Client::_open(Inode *in, int flags, mode_t mode, Fh **fhp,
|
||||
const UserPerm& perms)
|
||||
{
|
||||
if (in->snapid != CEPH_NOSNAP &&
|
||||
(flags & (O_WRONLY | O_RDWR | O_CREAT | O_TRUNC | O_APPEND))) {
|
||||
return -EROFS;
|
||||
}
|
||||
|
||||
int cmode = ceph_flags_to_mode(flags);
|
||||
if (cmode < 0)
|
||||
return -EINVAL;
|
||||
int want = ceph_caps_for_mode(cmode);
|
||||
int result = 0;
|
||||
|
||||
if (in->snapid != CEPH_NOSNAP &&
|
||||
(flags & (O_WRONLY | O_RDWR | O_CREAT | O_TRUNC | O_APPEND))) {
|
||||
return -EROFS;
|
||||
}
|
||||
|
||||
in->get_open_ref(cmode); // make note of pending open, since it effects _wanted_ caps.
|
||||
|
||||
if ((flags & O_TRUNC) == 0 &&
|
||||
|
Loading…
Reference in New Issue
Block a user