Unverified Commit 8b42d863 authored by Steve French's avatar Steve French Committed by GitHub
Browse files

Merge pull request #48 from namjaejeon/cifsd-for-next

cifsd-fixes
parents e080fa80 eb817368
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -14,9 +14,7 @@ int ksmbd_acquire_smb2_tid(struct ida *ida)
{
	int id;

	id = __acquire_id(ida, 0, 0);
	if (id == 0xFFFF)
		id = __acquire_id(ida, 0, 0);
	id = __acquire_id(ida, 1, 0xFFFFFFFF);

	return id;
}
+51 −1
Original line number Diff line number Diff line
@@ -4622,7 +4622,8 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
					       FILE_PERSISTENT_ACLS |
					       FILE_UNICODE_ON_DISK |
					       FILE_CASE_PRESERVED_NAMES |
					       FILE_CASE_SENSITIVE_SEARCH);
					       FILE_CASE_SENSITIVE_SEARCH |
					       FILE_SUPPORTS_BLOCK_REFCOUNTING);

		info->Attributes |= cpu_to_le32(server_conf.share_fake_fscaps);

@@ -7330,6 +7331,55 @@ int smb2_ioctl(struct ksmbd_work *work)
		nbytes = sizeof(struct reparse_data_buffer);
		break;
	}
	case FSCTL_DUPLICATE_EXTENTS_TO_FILE:
	{
		struct ksmbd_file *fp_in, *fp_out = NULL;
		struct duplicate_extents_to_file *dup_ext;
		loff_t src_off, dst_off, length, cloned;

		dup_ext = (struct duplicate_extents_to_file *)&req->Buffer[0];

		fp_in = ksmbd_lookup_fd_slow(work, dup_ext->VolatileFileHandle,
				dup_ext->PersistentFileHandle);
		if (!fp_in) {
			ksmbd_err("not found file handle in duplicate extent to file\n");
			ret = -ENOENT;
			goto out;
		}

		fp_out = ksmbd_lookup_fd_fast(work, id);
		if (!fp_out) {
			ksmbd_err("not found fp\n");
			ret = -ENOENT;
			goto dup_ext_out;
		}

		src_off = le64_to_cpu(dup_ext->SourceFileOffset);
		dst_off = le64_to_cpu(dup_ext->TargetFileOffset);
		length = le64_to_cpu(dup_ext->ByteCount);
		cloned = vfs_clone_file_range(fp_in->filp, src_off, fp_out->filp,
				dst_off, length, 0);
		if (cloned == -EXDEV || cloned == -EOPNOTSUPP) {
			ret = -EOPNOTSUPP;
			goto dup_ext_out;
		} else if (cloned != length) {
			cloned = ksmbd_vfs_copy_file_range(fp_in->filp, src_off,
					fp_out->filp, dst_off, length);
			if (cloned != length) {
				if (cloned < 0)
					ret = cloned;
				else
					ret = -EINVAL;
			}
		}

dup_ext_out:
		ksmbd_fd_put(work, fp_in);
		ksmbd_fd_put(work, fp_out);
		if (ret < 0)
			goto out;
		break;
	}
	default:
		ksmbd_debug(SMB, "not implemented yet ioctl command 0x%x\n",
				cnt_code);
+8 −0
Original line number Diff line number Diff line
@@ -851,6 +851,14 @@ struct smb2_write_rsp {

#define SMB2_0_IOCTL_IS_FSCTL 0x00000001

struct duplicate_extents_to_file {
	__u64 PersistentFileHandle; /* source file handle, opaque endianness */
	__u64 VolatileFileHandle;
	__le64 SourceFileOffset;
	__le64 TargetFileOffset;
	__le64 ByteCount;  /* Bytes to be copied */
} __packed;

struct smb2_ioctl_req {
	struct smb2_hdr hdr;
	__le16 StructureSize; /* Must be 57 */
+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@
#define FSCTL_SET_SHORT_NAME_BEHAVIOR 0x000901B4 /* BB add struct */
#define FSCTL_QUERY_ALLOCATED_RANGES 0x000940CF /* BB add struct */
#define FSCTL_SET_DEFECT_MANAGEMENT  0x00098134 /* BB add struct */
#define FSCTL_DUPLICATE_EXTENTS_TO_FILE 0x00098344
#define FSCTL_SIS_LINK_FILES         0x0009C104
#define FSCTL_PIPE_PEEK              0x0011400C /* BB add struct */
#define FSCTL_PIPE_TRANSCEIVE        0x0011C017 /* BB add struct */
+1 −1
Original line number Diff line number Diff line
@@ -1789,7 +1789,7 @@ int ksmbd_vfs_xattr_stream_name(char *stream_name, char **xattr_stream_name,
	return 0;
}

static int ksmbd_vfs_copy_file_range(struct file *file_in, loff_t pos_in,
int ksmbd_vfs_copy_file_range(struct file *file_in, loff_t pos_in,
		struct file *file_out, loff_t pos_out, size_t len)
{
	struct inode *inode_in = file_inode(file_in);
Loading