Merge pull request #15354 from badone/wip-rados-ls-auth-fix

osd: Reverse order of op_has_sufficient_caps and do_pg_op

Reviewed-by: Greg Farnum <gfarnum@redhat.com>
This commit is contained in:
Sage Weil 2017-06-21 21:14:01 -05:00 committed by GitHub
commit 288f623878
3 changed files with 36 additions and 4 deletions

View File

@ -0,0 +1,9 @@
roles:
- [mon.a, mgr.x, osd.0, osd.1, client.0]
tasks:
- install:
- ceph:
- workunit:
clients:
all:
- rados/test_pool_access.sh

View File

@ -0,0 +1,23 @@
#!/bin/bash -x
set -e
expect_1()
{
set -x
set +e
"$@"
if [ $? == 1 ]; then return 0; else return 1; fi
}
key=`ceph auth get-or-create-key client.poolaccess1 mon 'allow r' osd 'allow *'`
rados --id poolaccess1 --key $key -p rbd ls
key=`ceph auth get-or-create-key client.poolaccess2 mon 'allow r' osd 'allow * pool=nopool'`
expect_1 rados --id poolaccess2 --key $key -p rbd ls
key=`ceph auth get-or-create-key client.poolaccess3 mon 'allow r' osd 'allow rw pool=nopool'`
expect_1 rados --id poolaccess3 --key $key -p rbd ls
echo OK

View File

@ -1877,15 +1877,15 @@ void PrimaryLogPG::do_op(OpRequestRef& op)
}
}
if (op->includes_pg_op()) {
return do_pg_op(op);
}
if (!op_has_sufficient_caps(op)) {
osd->reply_op_error(op, -EPERM);
return;
}
if (op->includes_pg_op()) {
return do_pg_op(op);
}
// object name too long?
if (m->get_oid().name.size() > cct->_conf->osd_max_object_name_len) {
dout(4) << "do_op name is longer than "