@@ -410,7 +410,7 @@ static void ceph_monc_handle_map(struct ceph_mon_client *monc,
410410}
411411
412412/*
413- * generic requests (e.g., statfs, poolop )
413+ * generic requests (currently statfs, mon_get_version )
414414 */
415415static struct ceph_mon_generic_request * __lookup_generic_req (
416416 struct ceph_mon_client * monc , u64 tid )
@@ -569,7 +569,7 @@ static void handle_statfs_reply(struct ceph_mon_client *monc,
569569 return ;
570570
571571bad :
572- pr_err ("corrupt generic reply, tid %llu\n" , tid );
572+ pr_err ("corrupt statfs reply, tid %llu\n" , tid );
573573 ceph_msg_dump (msg );
574574}
575575
@@ -588,7 +588,6 @@ int ceph_monc_do_statfs(struct ceph_mon_client *monc, struct ceph_statfs *buf)
588588
589589 kref_init (& req -> kref );
590590 req -> buf = buf ;
591- req -> buf_len = sizeof (* buf );
592591 init_completion (& req -> completion );
593592
594593 err = - ENOMEM ;
@@ -647,7 +646,7 @@ static void handle_get_version_reply(struct ceph_mon_client *monc,
647646
648647 return ;
649648bad :
650- pr_err ("corrupt mon_get_version reply\n" );
649+ pr_err ("corrupt mon_get_version reply, tid %llu \n" , tid );
651650 ceph_msg_dump (msg );
652651}
653652
@@ -670,7 +669,6 @@ int ceph_monc_do_get_version(struct ceph_mon_client *monc, const char *what,
670669
671670 kref_init (& req -> kref );
672671 req -> buf = newest ;
673- req -> buf_len = sizeof (* newest );
674672 init_completion (& req -> completion );
675673
676674 req -> request = ceph_msg_new (CEPH_MSG_MON_GET_VERSION ,
@@ -706,128 +704,6 @@ int ceph_monc_do_get_version(struct ceph_mon_client *monc, const char *what,
706704}
707705EXPORT_SYMBOL (ceph_monc_do_get_version );
708706
709- /*
710- * pool ops
711- */
712- static int get_poolop_reply_buf (const char * src , size_t src_len ,
713- char * dst , size_t dst_len )
714- {
715- u32 buf_len ;
716-
717- if (src_len != sizeof (u32 ) + dst_len )
718- return - EINVAL ;
719-
720- buf_len = le32_to_cpu (* (__le32 * )src );
721- if (buf_len != dst_len )
722- return - EINVAL ;
723-
724- memcpy (dst , src + sizeof (u32 ), dst_len );
725- return 0 ;
726- }
727-
728- static void handle_poolop_reply (struct ceph_mon_client * monc ,
729- struct ceph_msg * msg )
730- {
731- struct ceph_mon_generic_request * req ;
732- struct ceph_mon_poolop_reply * reply = msg -> front .iov_base ;
733- u64 tid = le64_to_cpu (msg -> hdr .tid );
734-
735- if (msg -> front .iov_len < sizeof (* reply ))
736- goto bad ;
737- dout ("handle_poolop_reply %p tid %llu\n" , msg , tid );
738-
739- mutex_lock (& monc -> mutex );
740- req = __lookup_generic_req (monc , tid );
741- if (req ) {
742- if (req -> buf_len &&
743- get_poolop_reply_buf (msg -> front .iov_base + sizeof (* reply ),
744- msg -> front .iov_len - sizeof (* reply ),
745- req -> buf , req -> buf_len ) < 0 ) {
746- mutex_unlock (& monc -> mutex );
747- goto bad ;
748- }
749- req -> result = le32_to_cpu (reply -> reply_code );
750- get_generic_request (req );
751- }
752- mutex_unlock (& monc -> mutex );
753- if (req ) {
754- complete (& req -> completion );
755- put_generic_request (req );
756- }
757- return ;
758-
759- bad :
760- pr_err ("corrupt generic reply, tid %llu\n" , tid );
761- ceph_msg_dump (msg );
762- }
763-
764- /*
765- * Do a synchronous pool op.
766- */
767- static int do_poolop (struct ceph_mon_client * monc , u32 op ,
768- u32 pool , u64 snapid ,
769- char * buf , int len )
770- {
771- struct ceph_mon_generic_request * req ;
772- struct ceph_mon_poolop * h ;
773- int err ;
774-
775- req = kzalloc (sizeof (* req ), GFP_NOFS );
776- if (!req )
777- return - ENOMEM ;
778-
779- kref_init (& req -> kref );
780- req -> buf = buf ;
781- req -> buf_len = len ;
782- init_completion (& req -> completion );
783-
784- err = - ENOMEM ;
785- req -> request = ceph_msg_new (CEPH_MSG_POOLOP , sizeof (* h ), GFP_NOFS ,
786- true);
787- if (!req -> request )
788- goto out ;
789- req -> reply = ceph_msg_new (CEPH_MSG_POOLOP_REPLY , 1024 , GFP_NOFS ,
790- true);
791- if (!req -> reply )
792- goto out ;
793-
794- /* fill out request */
795- req -> request -> hdr .version = cpu_to_le16 (2 );
796- h = req -> request -> front .iov_base ;
797- h -> monhdr .have_version = 0 ;
798- h -> monhdr .session_mon = cpu_to_le16 (-1 );
799- h -> monhdr .session_mon_tid = 0 ;
800- h -> fsid = monc -> monmap -> fsid ;
801- h -> pool = cpu_to_le32 (pool );
802- h -> op = cpu_to_le32 (op );
803- h -> auid = 0 ;
804- h -> snapid = cpu_to_le64 (snapid );
805- h -> name_len = 0 ;
806-
807- err = do_generic_request (monc , req );
808-
809- out :
810- kref_put (& req -> kref , release_generic_request );
811- return err ;
812- }
813-
814- int ceph_monc_create_snapid (struct ceph_mon_client * monc ,
815- u32 pool , u64 * snapid )
816- {
817- return do_poolop (monc , POOL_OP_CREATE_UNMANAGED_SNAP ,
818- pool , 0 , (char * )snapid , sizeof (* snapid ));
819-
820- }
821- EXPORT_SYMBOL (ceph_monc_create_snapid );
822-
823- int ceph_monc_delete_snapid (struct ceph_mon_client * monc ,
824- u32 pool , u64 snapid )
825- {
826- return do_poolop (monc , POOL_OP_CREATE_UNMANAGED_SNAP ,
827- pool , snapid , NULL , 0 );
828-
829- }
830-
831707/*
832708 * Resend pending generic requests.
833709 */
@@ -1112,10 +988,6 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg)
1112988 handle_get_version_reply (monc , msg );
1113989 break ;
1114990
1115- case CEPH_MSG_POOLOP_REPLY :
1116- handle_poolop_reply (monc , msg );
1117- break ;
1118-
1119991 case CEPH_MSG_MON_MAP :
1120992 ceph_monc_handle_map (monc , msg );
1121993 break ;
@@ -1154,7 +1026,6 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
11541026 case CEPH_MSG_MON_SUBSCRIBE_ACK :
11551027 m = ceph_msg_get (monc -> m_subscribe_ack );
11561028 break ;
1157- case CEPH_MSG_POOLOP_REPLY :
11581029 case CEPH_MSG_STATFS_REPLY :
11591030 return get_generic_reply (con , hdr , skip );
11601031 case CEPH_MSG_AUTH_REPLY :
0 commit comments