mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 07:50:04 +00:00
smb3: Move the flush out of smb2_copychunk_range() into its callers
Move the flush out of smb2_copychunk_range() into its callers. This will allow the pagecache to be invalidated between the flush and the operation in smb3_collapse_range() and smb3_insert_range(). Signed-off-by: David Howells <dhowells@redhat.com> cc: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
b90cb10531
commit
c3a72bb213
@ -1219,6 +1219,8 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
|
|||||||
|
|
||||||
cifs_dbg(FYI, "copychunk range\n");
|
cifs_dbg(FYI, "copychunk range\n");
|
||||||
|
|
||||||
|
filemap_write_and_wait(src_inode->i_mapping);
|
||||||
|
|
||||||
if (!src_file->private_data || !dst_file->private_data) {
|
if (!src_file->private_data || !dst_file->private_data) {
|
||||||
rc = -EBADF;
|
rc = -EBADF;
|
||||||
cifs_dbg(VFS, "missing cifsFileInfo on copy range src file\n");
|
cifs_dbg(VFS, "missing cifsFileInfo on copy range src file\n");
|
||||||
|
@ -1600,17 +1600,8 @@ smb2_copychunk_range(const unsigned int xid,
|
|||||||
int chunks_copied = 0;
|
int chunks_copied = 0;
|
||||||
bool chunk_sizes_updated = false;
|
bool chunk_sizes_updated = false;
|
||||||
ssize_t bytes_written, total_bytes_written = 0;
|
ssize_t bytes_written, total_bytes_written = 0;
|
||||||
struct inode *inode;
|
|
||||||
|
|
||||||
pcchunk = kmalloc(sizeof(struct copychunk_ioctl), GFP_KERNEL);
|
pcchunk = kmalloc(sizeof(struct copychunk_ioctl), GFP_KERNEL);
|
||||||
|
|
||||||
/*
|
|
||||||
* We need to flush all unwritten data before we can send the
|
|
||||||
* copychunk ioctl to the server.
|
|
||||||
*/
|
|
||||||
inode = d_inode(trgtfile->dentry);
|
|
||||||
filemap_write_and_wait(inode->i_mapping);
|
|
||||||
|
|
||||||
if (pcchunk == NULL)
|
if (pcchunk == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -3694,6 +3685,8 @@ static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filemap_write_and_wait(inode->i_mapping);
|
||||||
|
|
||||||
rc = smb2_copychunk_range(xid, cfile, cfile, off + len,
|
rc = smb2_copychunk_range(xid, cfile, cfile, off + len,
|
||||||
i_size_read(inode) - off - len, off);
|
i_size_read(inode) - off - len, off);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
@ -3721,18 +3714,21 @@ static long smb3_insert_range(struct file *file, struct cifs_tcon *tcon,
|
|||||||
int rc;
|
int rc;
|
||||||
unsigned int xid;
|
unsigned int xid;
|
||||||
struct cifsFileInfo *cfile = file->private_data;
|
struct cifsFileInfo *cfile = file->private_data;
|
||||||
|
struct inode *inode = file_inode(file);
|
||||||
__le64 eof;
|
__le64 eof;
|
||||||
__u64 count;
|
__u64 count;
|
||||||
|
|
||||||
xid = get_xid();
|
xid = get_xid();
|
||||||
|
|
||||||
if (off >= i_size_read(file->f_inode)) {
|
if (off >= i_size_read(inode)) {
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = i_size_read(file->f_inode) - off;
|
count = i_size_read(inode) - off;
|
||||||
eof = cpu_to_le64(i_size_read(file->f_inode) + len);
|
eof = cpu_to_le64(i_size_read(inode) + len);
|
||||||
|
|
||||||
|
filemap_write_and_wait(inode->i_mapping);
|
||||||
|
|
||||||
rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
|
rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
|
||||||
cfile->fid.volatile_fid, cfile->pid, &eof);
|
cfile->fid.volatile_fid, cfile->pid, &eof);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user