187 * Normally need just the source file size, etc. If doing
188 * Apple server-side copy, we want all the attributes.
189 */
190 if (aapl_copyfile)
191 args->src_attr.sa_mask = SMB_AT_ALL;
192 else
193 args->src_attr.sa_mask = SMB_AT_STANDARD;
194 status = smb2_ofile_getattr(sr, src_of, &args->src_attr);
195 if (status != 0)
196 goto out;
197
198 /*
199 * Get a buffer used for copying, always
200 * smb2_copychunk_max_seg (1M)
201 *
202 * Rather than sleep for this relatively large allocation,
203 * allow the allocation to fail and return an error.
204 * The client should then fall back to normal copy.
205 */
206 args->bufsize = smb2_copychunk_max_seg;
207 args->buffer = kmem_alloc(args->bufsize, KM_NOSLEEP | KM_NORMALPRI);
208 if (args->buffer == NULL) {
209 status = NT_STATUS_INSUFF_SERVER_RESOURCES;
210 goto out;
211 }
212
213 /*
214 * Finally, do the I/O
215 */
216 if (aapl_copyfile) {
217 status = smb2_fsctl_copychunk_aapl(sr, src_of, &ccr);
218 } else {
219 status = smb2_fsctl_copychunk_array(sr, src_of, &ccr);
220 }
221
222 out:
223 if (args != NULL) {
224 if (args->buffer != NULL) {
225 kmem_free(args->buffer, args->bufsize);
226 }
227 }
|
187 * Normally need just the source file size, etc. If doing
188 * Apple server-side copy, we want all the attributes.
189 */
190 if (aapl_copyfile)
191 args->src_attr.sa_mask = SMB_AT_ALL;
192 else
193 args->src_attr.sa_mask = SMB_AT_STANDARD;
194 status = smb2_ofile_getattr(sr, src_of, &args->src_attr);
195 if (status != 0)
196 goto out;
197
198 /*
199 * Get a buffer used for copying, always
200 * smb2_copychunk_max_seg (1M)
201 *
202 * Rather than sleep for this relatively large allocation,
203 * allow the allocation to fail and return an error.
204 * The client should then fall back to normal copy.
205 */
206 args->bufsize = smb2_copychunk_max_seg;
207 args->buffer = kmem_alloc(args->bufsize, KM_NOSLEEP_LAZY);
208 if (args->buffer == NULL) {
209 status = NT_STATUS_INSUFF_SERVER_RESOURCES;
210 goto out;
211 }
212
213 /*
214 * Finally, do the I/O
215 */
216 if (aapl_copyfile) {
217 status = smb2_fsctl_copychunk_aapl(sr, src_of, &ccr);
218 } else {
219 status = smb2_fsctl_copychunk_array(sr, src_of, &ccr);
220 }
221
222 out:
223 if (args != NULL) {
224 if (args->buffer != NULL) {
225 kmem_free(args->buffer, args->bufsize);
226 }
227 }
|