@@ -623,6 +623,62 @@ static int nfs4_xdr_dec_cb_layout(struct rpc_rqst *rqstp,
623
623
}
624
624
#endif /* CONFIG_NFSD_PNFS */
625
625
626
+ static void encode_stateowner (struct xdr_stream * xdr , struct nfs4_stateowner * so )
627
+ {
628
+ __be32 * p ;
629
+
630
+ p = xdr_reserve_space (xdr , 8 + 4 + so -> so_owner .len );
631
+ p = xdr_encode_opaque_fixed (p , & so -> so_client -> cl_clientid , 8 );
632
+ xdr_encode_opaque (p , so -> so_owner .data , so -> so_owner .len );
633
+ }
634
+
635
+ static void nfs4_xdr_enc_cb_notify_lock (struct rpc_rqst * req ,
636
+ struct xdr_stream * xdr ,
637
+ const struct nfsd4_callback * cb )
638
+ {
639
+ const struct nfsd4_blocked_lock * nbl =
640
+ container_of (cb , struct nfsd4_blocked_lock , nbl_cb );
641
+ struct nfs4_lockowner * lo = (struct nfs4_lockowner * )nbl -> nbl_lock .fl_owner ;
642
+ struct nfs4_cb_compound_hdr hdr = {
643
+ .ident = 0 ,
644
+ .minorversion = cb -> cb_clp -> cl_minorversion ,
645
+ };
646
+
647
+ __be32 * p ;
648
+
649
+ BUG_ON (hdr .minorversion == 0 );
650
+
651
+ encode_cb_compound4args (xdr , & hdr );
652
+ encode_cb_sequence4args (xdr , cb , & hdr );
653
+
654
+ p = xdr_reserve_space (xdr , 4 );
655
+ * p = cpu_to_be32 (OP_CB_NOTIFY_LOCK );
656
+ encode_nfs_fh4 (xdr , & nbl -> nbl_fh );
657
+ encode_stateowner (xdr , & lo -> lo_owner );
658
+ hdr .nops ++ ;
659
+
660
+ encode_cb_nops (& hdr );
661
+ }
662
+
663
+ static int nfs4_xdr_dec_cb_notify_lock (struct rpc_rqst * rqstp ,
664
+ struct xdr_stream * xdr ,
665
+ struct nfsd4_callback * cb )
666
+ {
667
+ struct nfs4_cb_compound_hdr hdr ;
668
+ int status ;
669
+
670
+ status = decode_cb_compound4res (xdr , & hdr );
671
+ if (unlikely (status ))
672
+ return status ;
673
+
674
+ if (cb ) {
675
+ status = decode_cb_sequence4res (xdr , cb );
676
+ if (unlikely (status || cb -> cb_seq_status ))
677
+ return status ;
678
+ }
679
+ return decode_cb_op_status (xdr , OP_CB_NOTIFY_LOCK , & cb -> cb_status );
680
+ }
681
+
626
682
/*
627
683
* RPC procedure tables
628
684
*/
@@ -643,6 +699,7 @@ static struct rpc_procinfo nfs4_cb_procedures[] = {
643
699
#ifdef CONFIG_NFSD_PNFS
644
700
PROC (CB_LAYOUT , COMPOUND , cb_layout , cb_layout ),
645
701
#endif
702
+ PROC (CB_NOTIFY_LOCK , COMPOUND , cb_notify_lock , cb_notify_lock ),
646
703
};
647
704
648
705
static struct rpc_version nfs_cb_version4 = {
0 commit comments