mirror of
https://github.com/ceph/ceph
synced 2025-02-21 01:47:25 +00:00
mds: Fix SnapRealm differ check in CInode::encode_inodestat()
When checking if inode's SnapRealm is different from readdir SnapRealm, we should use find_snaprealm() to get inode's SnapRealm. Without this fix, I got lots of "ceph_add_cap: couldn't find snap realm 100" from kernel client. Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
This commit is contained in:
parent
eafe0a8acb
commit
3384431b6d
@ -2554,7 +2554,7 @@ void CInode::replicate_relax_locks()
|
||||
// =============================================
|
||||
|
||||
int CInode::encode_inodestat(bufferlist& bl, Session *session,
|
||||
SnapRealm *realm,
|
||||
SnapRealm *dir_realm,
|
||||
snapid_t snapid, unsigned max_bytes)
|
||||
{
|
||||
int client = session->inst.name.num();
|
||||
@ -2565,7 +2565,8 @@ int CInode::encode_inodestat(bufferlist& bl, Session *session,
|
||||
bool valid = true;
|
||||
|
||||
// do not issue caps if inode differs from readdir snaprealm
|
||||
bool no_caps = (realm && snaprealm && realm != snaprealm);
|
||||
SnapRealm *realm = find_snaprealm();
|
||||
bool no_caps = (realm && dir_realm && realm != dir_realm);
|
||||
if (no_caps)
|
||||
dout(20) << "encode_inodestat realm=" << realm << " snaprealm " << snaprealm
|
||||
<< " no_caps=" << no_caps << dendl;
|
||||
@ -2724,7 +2725,7 @@ int CInode::encode_inodestat(bufferlist& bl, Session *session,
|
||||
} else {
|
||||
if (!no_caps && valid && !cap) {
|
||||
// add a new cap
|
||||
cap = add_client_cap(client, session, find_snaprealm());
|
||||
cap = add_client_cap(client, session, realm);
|
||||
if (is_auth()) {
|
||||
if (choose_ideal_loner() >= 0)
|
||||
try_set_loner();
|
||||
@ -2747,7 +2748,7 @@ int CInode::encode_inodestat(bufferlist& bl, Session *session,
|
||||
e.cap.seq = cap->get_last_seq();
|
||||
dout(10) << "encode_inodestat issueing " << ccap_string(issue) << " seq " << cap->get_last_seq() << dendl;
|
||||
e.cap.mseq = cap->get_mseq();
|
||||
e.cap.realm = find_snaprealm()->inode->ino();
|
||||
e.cap.realm = realm->inode->ino();
|
||||
} else {
|
||||
e.cap.cap_id = 0;
|
||||
e.cap.caps = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user