From 8f665199fa702988c627662f7673a11ef7e3c71b Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Mon, 22 Apr 2019 16:37:42 -0500
Subject: [PATCH] SMB3: allowing extending size if allocating on non-sparse
file
This is simply the same as changing the end of file.
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
fs/cifs/smb2ops.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
@@ -2920,9 +2920,12 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
else if (i_size_read(inode) >= off + len)
/* not extending file and already not sparse */
rc = 0;
- /* BB: in future add else clause to extend file */
- else
- rc = -EOPNOTSUPP;
+ else {
+ __le64 length = cpu_to_le64(off+len);
+
+ rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
+ cfile->fid.volatile_fid, cfile->pid, &length);
+ }
if (rc)
trace_smb3_falloc_err(xid, cfile->fid.persistent_fid,
tcon->tid, tcon->ses->Suid, off, len, rc);
--
2.17.1