@@ -2835,42 +2835,20 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
2835
2835
}
2836
2836
2837
2837
if (* oplock == SMB2_OPLOCK_LEVEL_BATCH ) {
2838
- /* need to set Next field of lease context if we request it */
2839
- if (server -> capabilities & SMB2_GLOBAL_CAP_LEASING ) {
2840
- struct create_context * ccontext =
2841
- (struct create_context * )iov [n_iov - 1 ].iov_base ;
2842
- ccontext -> Next =
2843
- cpu_to_le32 (server -> vals -> create_lease_size );
2844
- }
2845
-
2846
2838
rc = add_durable_context (iov , & n_iov , oparms ,
2847
2839
tcon -> use_persistent );
2848
2840
if (rc )
2849
2841
return rc ;
2850
2842
}
2851
2843
2852
2844
if (tcon -> posix_extensions ) {
2853
- if (n_iov > 2 ) {
2854
- struct create_context * ccontext =
2855
- (struct create_context * )iov [n_iov - 1 ].iov_base ;
2856
- ccontext -> Next =
2857
- cpu_to_le32 (iov [n_iov - 1 ].iov_len );
2858
- }
2859
-
2860
2845
rc = add_posix_context (iov , & n_iov , oparms -> mode );
2861
2846
if (rc )
2862
2847
return rc ;
2863
2848
}
2864
2849
2865
2850
if (tcon -> snapshot_time ) {
2866
2851
cifs_dbg (FYI , "adding snapshot context\n" );
2867
- if (n_iov > 2 ) {
2868
- struct create_context * ccontext =
2869
- (struct create_context * )iov [n_iov - 1 ].iov_base ;
2870
- ccontext -> Next =
2871
- cpu_to_le32 (iov [n_iov - 1 ].iov_len );
2872
- }
2873
-
2874
2852
rc = add_twarp_context (iov , & n_iov , tcon -> snapshot_time );
2875
2853
if (rc )
2876
2854
return rc ;
@@ -2894,24 +2872,13 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
2894
2872
set_owner = false;
2895
2873
2896
2874
if (set_owner | set_mode ) {
2897
- if (n_iov > 2 ) {
2898
- struct create_context * ccontext =
2899
- (struct create_context * )iov [n_iov - 1 ].iov_base ;
2900
- ccontext -> Next = cpu_to_le32 (iov [n_iov - 1 ].iov_len );
2901
- }
2902
-
2903
2875
cifs_dbg (FYI , "add sd with mode 0x%x\n" , oparms -> mode );
2904
2876
rc = add_sd_context (iov , & n_iov , oparms -> mode , set_owner );
2905
2877
if (rc )
2906
2878
return rc ;
2907
2879
}
2908
2880
}
2909
2881
2910
- if (n_iov > 2 ) {
2911
- struct create_context * ccontext =
2912
- (struct create_context * )iov [n_iov - 1 ].iov_base ;
2913
- ccontext -> Next = cpu_to_le32 (iov [n_iov - 1 ].iov_len );
2914
- }
2915
2882
add_query_id_context (iov , & n_iov );
2916
2883
2917
2884
if (n_iov > 2 ) {
@@ -2922,6 +2889,15 @@ SMB2_open_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
2922
2889
req -> CreateContextsOffset = cpu_to_le32 (
2923
2890
sizeof (struct smb2_create_req ) +
2924
2891
iov [1 ].iov_len );
2892
+
2893
+ for (unsigned int i = 2 ; i < (n_iov - 1 ); i ++ ) {
2894
+ struct kvec * v = & iov [i ];
2895
+ size_t len = v -> iov_len ;
2896
+ struct create_context * cctx =
2897
+ (struct create_context * )v -> iov_base ;
2898
+
2899
+ cctx -> Next = cpu_to_le32 (len );
2900
+ }
2925
2901
}
2926
2902
2927
2903
rqst -> rq_nvec = n_iov ;
0 commit comments