diff mbox series

SMB3: allowing extending size if allocating on non-sparse file

Message ID CAH2r5muC05zDdP7EsThSE9+xxPwrmFnzW7NqAtRQgoF3P3dk_Q@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series SMB3: allowing extending size if allocating on non-sparse file | expand

Commit Message

Steve French April 22, 2019, 9:52 p.m. UTC
This is simply the same as changing the end of file.
diff mbox series

Patch

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(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index c3480a976660..f8cfcba797f3 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -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