Project

General

Profile

Actions

Bug #76728

closed
DP DP

mds: recreating client session from journal leads to empty auth_name in session's session info struct

Bug #76728: mds: recreating client session from journal leads to empty auth_name in session's session info struct

Added by Dhairya Parmar 7 months ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Urgent
Category:
Correctness/Safety
Target version:
Due date:
% Done:

0%

Source:
Q/A
Backport:
tentacle,squid
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
Client, Ganesha FSAL, MDS, libcephfs
Labels (FS):
NFS-cluster
Pull request ID:
Tags (freeform):
Fixed In:
v21.0.0-1916-gaa6230ff21
Released In:
v21.2.0~312
Upkeep Timestamp:
2026-10-24T02:17:46+00:00

Description

SessionMap::_mark_dirty does a lazy commit of the SessionMap version and the session info. The frequency of the commit is based on mds_sessionmap_keys_per_op config. If the active MDS crashes before the version and session info can be committed into OMAP then when the mds failover takes place, the new active MDS replays the journal and recreates the client sessions in ESession::replay but since the OMAP isn't up to date, else if (mds->sessionmap.get_version() + 1 == cmapv) block gets triggered. Here cmapv is part of the ESession class and is encoded and persisted in journal for every ESession journal event and mds->sessionmap.get_version() is from the OMAP.

So when that else if{} block executes, it means the new active MDS sees that the sessionmap version in OMAP has lagged behind by one session operation as compared to the version stored in journal (ESession event). When this happens it checks the open flag which is again part of the ESession event and if that is the case it tries to get or create a new session via session = mds->sessionmap.get_or_add_session(client_inst), here since the OMAP has lagged behind the journal (because of the lazy commit mentioned above) -- mds->sessionmap doesn't contain the client_inst and hence the else {} block gets executed and the Session created is with defaults:

  Session(ConnectionRef con) :
    item_session_list(this),
    requests(member_offset(MDRequestImpl, item_session_request)),
    recall_caps(g_conf().get_val<double>("mds_recall_warning_decay_rate")),
    release_caps(g_conf().get_val<double>("mds_recall_warning_decay_rate")),
    recall_caps_throttle(g_conf().get_val<double>("mds_recall_max_decay_rate")),
    recall_caps_throttle2o(0.5),
    session_cache_liveness(g_conf().get_val<double>("mds_session_cache_liveness_decay_rate")),
    cap_acquisition(g_conf().get_val<double>("mds_session_cap_acquisition_decay_rate")),
    birth_time(clock::now())
  {
    set_connection(std::move(con));
  }

which means the session_info_t info's auth_name (which is of type EntityType) will have the empty strings for id and and type_id and hence when a client like NFS ganesha daemon requests for reclaiming the session via Server::reclaim_session, it can't since the target session's auth_name is empty:

if (session->info.auth_name != target->info.auth_name) {
      dout(10) << __func__ << " session auth_name " << session->info.auth_name
           << " != target auth_name " << target->info.auth_name << dendl;
      reply->set_result(-EPERM);
      mds->send_message_client(reply, session);
}

This means whenever a client like NFS Ganesha tries to reclaim a session and that session is not persisted to the OMAP because the active MDS failed before that commit could take place, the reclaim will fail with EPERM.


Related issues 2 (0 open — 2 closed)

Copied to CephFS - Backport #77061: squid: mds: recreating client session from journal leads to empty auth_name in session's session info structResolvedDhairya Parmar

Actions
Copied to CephFS - Backport #77062: tentacle: mds: recreating client session from journal leads to empty auth_name in session's session info structResolvedDhairya Parmar

Actions

DP Updated by Dhairya Parmar 7 months ago Actions #1

  • Severity changed from 3 - minor to 2 - major

CH Updated by Christopher Hoffman 7 months ago Actions #2

Here's a reproducer for this using vstart

set -x
sudo umount /mnt/* -l; sleep 2s; sudo killall -9 ceph-mon ceph-mon ceph-osd ceph-mds ceph-mgr ganesha.nfsd;
NFS=2 MDS=2 ../src/vstart.sh -d -n -l -o "debug mds = 20 debug client = 20" 

sleep 3s

PORT=`cat dev/ganesha.b/ganesha-b.conf  | grep Port | awk '{print $3}' | awk -F";" '{print $1}'`
sudo mount -t nfs -o port=$PORT 127.0.0.1:/cephfs /mnt/mycephfs

sleep 3s
MDS_PID=`ps aux | grep mds | grep "\-i b" | awk '{print $2}'`
GANESHA_PID=`ps aux | grep ganesha | grep ganesha-b | grep -v grep| awk '{print $2}' `

dd if=/dev/zero of=/mnt/mycephfs/file1 bs=1M count=1 ; sync

sleep 5s

kill -9 $GANESHA_PID
sleep 5s
kill -9 $MDS_PID

sleep 3s

ganesha.nfsd -L /home/choffman/code/ceph/build/out/ganesha-b.log -f /home/choffman/code/ceph/build/dev/ganesha.b/ganesha-b.conf -p /home/choffman/code/ceph/build/out/ganesha-b.pid -N NIV_EVENT

sleep 30s
grep -r auth_name out -a

VS Updated by Venky Shankar 7 months ago Actions #3

  • Status changed from New to Fix Under Review
  • Assignee set to Dhairya Parmar
  • Target version set to v21.0.0
  • Backport set to tentacle,squid
  • Pull request ID set to 69037
  • Component(FS) Client, libcephfs added

VS Updated by Venky Shankar 7 months ago Actions #4

  • Component(FS) Ganesha FSAL added

UB Updated by Upkeep Bot 6 months ago Actions #5

  • Status changed from Fix Under Review to Pending Backport
  • Merge Commit set to aa6230ff21f451443cb5e437efe5f1a940ab4f6d
  • Fixed In set to v21.0.0-1916-gaa6230ff21
  • Upkeep Timestamp set to 2026-06-02T08:56:52+00:00

UB Updated by Upkeep Bot 6 months ago Actions #6

  • Copied to Backport #77061: squid: mds: recreating client session from journal leads to empty auth_name in session's session info struct added

UB Updated by Upkeep Bot 6 months ago Actions #7

  • Copied to Backport #77062: tentacle: mds: recreating client session from journal leads to empty auth_name in session's session info struct added

UB Updated by Upkeep Bot 6 months ago Actions #8

  • Tags (freeform) set to backport_processed

UB Updated by Upkeep Bot 3 months ago Actions #9

  • Status changed from Pending Backport to Backporting
  • Tags (freeform) deleted (backport_processed)
  • Upkeep Timestamp changed from 2026-06-02T08:56:52+00:00 to 2026-08-27T18:33:32+00:00

UB Updated by Upkeep Bot about 2 months ago Actions #10

  • Status changed from Backporting to Resolved
  • Upkeep Timestamp changed from 2026-08-27T18:33:32+00:00 to 2026-10-13T13:00:50+00:00

UB Updated by Upkeep Bot about 1 month ago Actions #11

  • Released In set to v21.2.0~312
  • Upkeep Timestamp changed from 2026-10-13T13:00:50+00:00 to 2026-10-24T02:17:46+00:00
Actions

Also available in: PDF Atom