mirror of
https://github.com/ceph/ceph
synced 2024-12-17 17:05:42 +00:00
client: close directory's snapdir when deleting directory
Signed-off-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
parent
f180ad149a
commit
3099cabd11
@ -1777,12 +1777,11 @@ void Client::put_request(MetaRequest *request)
|
||||
request->take_other_inode(&other_in);
|
||||
delete request;
|
||||
|
||||
if (other_in) {
|
||||
if (other_in->dir &&
|
||||
(op == CEPH_MDS_OP_RMDIR ||
|
||||
op == CEPH_MDS_OP_RENAME ||
|
||||
op == CEPH_MDS_OP_RMSNAP))
|
||||
_try_to_trim_inode(other_in.get(), false);
|
||||
if (other_in &&
|
||||
(op == CEPH_MDS_OP_RMDIR ||
|
||||
op == CEPH_MDS_OP_RENAME ||
|
||||
op == CEPH_MDS_OP_RMSNAP)) {
|
||||
_try_to_trim_inode(other_in.get(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4824,6 +4823,12 @@ void Client::_try_to_trim_inode(Inode *in, bool sched_inval)
|
||||
}
|
||||
}
|
||||
|
||||
if (ref > 0 && (in->flags & I_SNAPDIR_OPEN)) {
|
||||
InodeRef snapdir = open_snapdir(in);
|
||||
_try_to_trim_inode(snapdir.get(), false);
|
||||
--ref;
|
||||
}
|
||||
|
||||
if (ref > 0 && in->ll_ref > 0 && sched_inval) {
|
||||
set<Dentry*>::iterator q = in->dn_set.begin();
|
||||
while (q != in->dn_set.end()) {
|
||||
@ -9487,6 +9492,7 @@ Inode *Client::open_snapdir(Inode *diri)
|
||||
|
||||
in->dirfragtree.clear();
|
||||
in->snapdir_parent = diri;
|
||||
diri->flags |= I_SNAPDIR_OPEN;
|
||||
inode_map[vino] = in;
|
||||
if (use_faked_inos())
|
||||
_assign_faked_ino(in);
|
||||
|
@ -15,7 +15,11 @@ Inode::~Inode()
|
||||
{
|
||||
cap_item.remove_myself();
|
||||
snaprealm_item.remove_myself();
|
||||
snapdir_parent.reset();
|
||||
|
||||
if (snapdir_parent) {
|
||||
snapdir_parent->flags &= ~I_SNAPDIR_OPEN;
|
||||
snapdir_parent.reset();
|
||||
}
|
||||
|
||||
if (!oset.objects.empty()) {
|
||||
lsubdout(client->cct, client, 0) << __func__ << ": leftover objects on inode 0x"
|
||||
|
@ -78,6 +78,7 @@ struct CapSnap {
|
||||
#define I_COMPLETE 1
|
||||
#define I_DIR_ORDERED 2
|
||||
#define I_CAP_DROPPED 4
|
||||
#define I_SNAPDIR_OPEN 8
|
||||
|
||||
struct Inode {
|
||||
Client *client;
|
||||
|
Loading…
Reference in New Issue
Block a user