mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
add unlink, rmdir check_access
Signed-off-by: Jashan Kamboj <jashank42@gmail.com>
This commit is contained in:
parent
3d2e604ec7
commit
3b42d57695
@ -5212,6 +5212,8 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
|
||||
return;
|
||||
}
|
||||
|
||||
CInode *diri = dn->get_dir()->get_inode();
|
||||
|
||||
CDentry::linkage_t *dnl = dn->get_linkage(client, mdr);
|
||||
assert(!dnl->is_null());
|
||||
|
||||
@ -5260,8 +5262,8 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
|
||||
for (int i=0; i<(int)trace.size()-1; i++)
|
||||
rdlocks.insert(&trace[i]->lock);
|
||||
xlocks.insert(&dn->lock);
|
||||
wrlocks.insert(&dn->get_dir()->inode->filelock);
|
||||
wrlocks.insert(&dn->get_dir()->inode->nestlock);
|
||||
wrlocks.insert(&diri->filelock);
|
||||
wrlocks.insert(&diri->nestlock);
|
||||
xlocks.insert(&in->linklock);
|
||||
if (straydn) {
|
||||
wrlocks.insert(&straydn->get_dir()->inode->filelock);
|
||||
@ -5275,6 +5277,9 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
|
||||
if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
|
||||
return;
|
||||
|
||||
if (!check_access(mdr, diri, MAY_WRITE))
|
||||
return;
|
||||
|
||||
if (in->is_dir() &&
|
||||
_dir_is_nonempty(mdr, in)) {
|
||||
respond_to_request(mdr, -ENOTEMPTY);
|
||||
|
Loading…
Reference in New Issue
Block a user