Commit c1332049 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag '6.10-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

 - two important netfs integration fixes - including for a data
   corruption and also fixes for multiple xfstests

 - reenable swap support over SMB3

* tag '6.10-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: Fix missing set of remote_i_size
  cifs: Fix smb3_insert_range() to move the zero_point
  cifs: update internal version number
  smb3: reenable swapfiles over SMB3 mounts
parents 9b62e02e 93a43155
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ static void netfs_cleanup_dio_write(struct netfs_io_request *wreq)
 * Perform an unbuffered write where we may have to do an RMW operation on an
 * encrypted file.  This can also be used for direct I/O writes.
 */
static ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *iter,
ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *iter,
						  struct netfs_group *netfs_group)
{
	struct netfs_io_request *wreq;
@@ -117,6 +117,7 @@ static ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov
	netfs_put_request(wreq, false, netfs_rreq_trace_put_return);
	return ret;
}
EXPORT_SYMBOL(netfs_unbuffered_write_iter_locked);

/**
 * netfs_unbuffered_write_iter - Unbuffered write to a file
+3 −3
Original line number Diff line number Diff line
@@ -1226,7 +1226,7 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
	struct cifsFileInfo *smb_file_src = src_file->private_data;
	struct cifsFileInfo *smb_file_target = dst_file->private_data;
	struct cifs_tcon *target_tcon, *src_tcon;
	unsigned long long destend, fstart, fend, new_size;
	unsigned long long destend, fstart, fend, old_size, new_size;
	unsigned int xid;
	int rc;

@@ -1293,6 +1293,7 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
		goto unlock;
	if (fend > target_cifsi->netfs.zero_point)
		target_cifsi->netfs.zero_point = fend + 1;
	old_size = target_cifsi->netfs.remote_i_size;

	/* Discard all the folios that overlap the destination region. */
	cifs_dbg(FYI, "about to discard pages %llx-%llx\n", fstart, fend);
@@ -1305,9 +1306,8 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
	if (target_tcon->ses->server->ops->duplicate_extents) {
		rc = target_tcon->ses->server->ops->duplicate_extents(xid,
			smb_file_src, smb_file_target, off, len, destoff);
		if (rc == 0 && new_size > i_size_read(target_inode)) {
		if (rc == 0 && new_size > old_size) {
			truncate_setsize(target_inode, new_size);
			netfs_resize_file(&target_cifsi->netfs, new_size, true);
			fscache_resize_cookie(cifs_inode_cookie(target_inode),
					      new_size);
		}
+2 −2
Original line number Diff line number Diff line
@@ -147,6 +147,6 @@ extern const struct export_operations cifs_export_ops;
#endif /* CONFIG_CIFS_NFSD_EXPORT */

/* when changing internal version - update following two lines at same time */
#define SMB3_PRODUCT_BUILD 48
#define CIFS_VERSION   "2.48"
#define SMB3_PRODUCT_BUILD 49
#define CIFS_VERSION   "2.49"
#endif				/* _CIFSFS_H */
+23 −0
Original line number Diff line number Diff line
@@ -3189,6 +3189,28 @@ static void cifs_swap_deactivate(struct file *file)
	/* do we need to unpin (or unlock) the file */
}

/**
 * cifs_swap_rw - SMB3 address space operation for swap I/O
 * @iocb: target I/O control block
 * @iter: I/O buffer
 *
 * Perform IO to the swap-file.  This is much like direct IO.
 */
static int cifs_swap_rw(struct kiocb *iocb, struct iov_iter *iter)
{
	ssize_t ret;

	WARN_ON_ONCE(iov_iter_count(iter) != PAGE_SIZE);

	if (iov_iter_rw(iter) == READ)
		ret = netfs_unbuffered_read_iter_locked(iocb, iter);
	else
		ret = netfs_unbuffered_write_iter_locked(iocb, iter, NULL);
	if (ret < 0)
		return ret;
	return 0;
}

const struct address_space_operations cifs_addr_ops = {
	.read_folio	= netfs_read_folio,
	.readahead	= netfs_readahead,
@@ -3204,6 +3226,7 @@ const struct address_space_operations cifs_addr_ops = {
	 */
	.swap_activate	= cifs_swap_activate,
	.swap_deactivate = cifs_swap_deactivate,
	.swap_rw = cifs_swap_rw,
};

/*
+2 −0
Original line number Diff line number Diff line
@@ -2028,6 +2028,7 @@ smb2_duplicate_extents(const unsigned int xid,
		 * size will be queried on next revalidate, but it is important
		 * to make sure that file's cached size is updated immediately
		 */
		netfs_resize_file(netfs_inode(inode), dest_off + len, true);
		cifs_setsize(inode, dest_off + len);
	}
	rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid,
@@ -3636,6 +3637,7 @@ static long smb3_insert_range(struct file *file, struct cifs_tcon *tcon,
	rc = smb2_copychunk_range(xid, cfile, cfile, off, count, off + len);
	if (rc < 0)
		goto out_2;
	cifsi->netfs.zero_point = new_eof;

	rc = smb3_zero_data(file, tcon, off, len, xid);
	if (rc < 0)
Loading