@@ -1194,30 +1194,22 @@ static void finish_hunting(struct ceph_mon_client *monc)
11941194 }
11951195}
11961196
1197- static void handle_auth_reply (struct ceph_mon_client * monc ,
1198- struct ceph_msg * msg )
1197+ static void finish_auth (struct ceph_mon_client * monc , int auth_err ,
1198+ bool was_authed )
11991199{
1200- int ret ;
1201- int was_auth = 0 ;
1200+ dout ( "%s auth_err %d was_authed %d\n" , __func__ , auth_err , was_authed ) ;
1201+ WARN_ON ( auth_err > 0 ) ;
12021202
1203- mutex_lock (& monc -> mutex );
1204- was_auth = ceph_auth_is_authenticated (monc -> auth );
12051203 monc -> pending_auth = 0 ;
1206- ret = ceph_handle_auth_reply (monc -> auth , msg -> front .iov_base ,
1207- msg -> front .iov_len ,
1208- monc -> m_auth -> front .iov_base ,
1209- monc -> m_auth -> front_alloc_len );
1210- if (ret > 0 ) {
1211- __send_prepared_auth_request (monc , ret );
1212- goto out ;
1204+ if (auth_err ) {
1205+ monc -> client -> auth_err = auth_err ;
1206+ wake_up_all (& monc -> client -> auth_wq );
1207+ return ;
12131208 }
12141209
1215- finish_hunting (monc );
1216-
1217- if (ret < 0 ) {
1218- monc -> client -> auth_err = ret ;
1219- } else if (!was_auth && ceph_auth_is_authenticated (monc -> auth )) {
1220- dout ("authenticated, starting session\n" );
1210+ if (!was_authed && ceph_auth_is_authenticated (monc -> auth )) {
1211+ dout ("%s authenticated, starting session global_id %llu\n" ,
1212+ __func__ , monc -> auth -> global_id );
12211213
12221214 monc -> client -> msgr .inst .name .type = CEPH_ENTITY_TYPE_CLIENT ;
12231215 monc -> client -> msgr .inst .name .num =
@@ -1229,11 +1221,27 @@ static void handle_auth_reply(struct ceph_mon_client *monc,
12291221 pr_info ("mon%d %s session established\n" , monc -> cur_mon ,
12301222 ceph_pr_addr (& monc -> con .peer_addr ));
12311223 }
1224+ }
12321225
1233- out :
1226+ static void handle_auth_reply (struct ceph_mon_client * monc ,
1227+ struct ceph_msg * msg )
1228+ {
1229+ bool was_authed ;
1230+ int ret ;
1231+
1232+ mutex_lock (& monc -> mutex );
1233+ was_authed = ceph_auth_is_authenticated (monc -> auth );
1234+ ret = ceph_handle_auth_reply (monc -> auth , msg -> front .iov_base ,
1235+ msg -> front .iov_len ,
1236+ monc -> m_auth -> front .iov_base ,
1237+ monc -> m_auth -> front_alloc_len );
1238+ if (ret > 0 ) {
1239+ __send_prepared_auth_request (monc , ret );
1240+ } else {
1241+ finish_auth (monc , ret , was_authed );
1242+ finish_hunting (monc );
1243+ }
12341244 mutex_unlock (& monc -> mutex );
1235- if (monc -> client -> auth_err < 0 )
1236- wake_up_all (& monc -> client -> auth_wq );
12371245}
12381246
12391247static int __validate_auth (struct ceph_mon_client * monc )
0 commit comments