All of lore.kernel.org
 help / color / mirror / Atom feed
* more fallocate fixes
@ 2019-03-14  2:17 Ronnie Sahlberg
  2019-03-14  2:17 ` [PATCH] cifs: fix fallocate(mode==0) for extending non-sparse files Ronnie Sahlberg
  0 siblings, 1 reply; 2+ messages in thread
From: Ronnie Sahlberg @ 2019-03-14  2:17 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French

Steve,
another small patch.
This to handle the case where fallocate(mode==0) needs to extend a non-sparse
file.
In this case we can just call SMB2_set_eof() and the magic should happen.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] cifs: fix fallocate(mode==0) for extending non-sparse files
  2019-03-14  2:17 more fallocate fixes Ronnie Sahlberg
@ 2019-03-14  2:17 ` Ronnie Sahlberg
  0 siblings, 0 replies; 2+ messages in thread
From: Ronnie Sahlberg @ 2019-03-14  2:17 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French, Ronnie Sahlberg

Add support for the case when fallocate(mode==0) and we need to extend a
non-sparse file.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2ops.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 32dde87feaa9..eee5a27ca95e 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -2718,6 +2718,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
 	struct cifsFileInfo *cfile = file->private_data;
 	long rc = -EOPNOTSUPP;
 	unsigned int xid;
+	__le64 eof;
 
 	xid = get_xid();
 
@@ -2747,9 +2748,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 {
+			eof = cpu_to_le64(off + len);
+			rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
+					  cfile->fid.volatile_fid,
+					  cfile->pid, &eof);
+		}
 		if (rc)
 			trace_smb3_falloc_err(xid, cfile->fid.persistent_fid,
 				tcon->tid, tcon->ses->Suid, off, len, rc);
-- 
2.13.6


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-14  2:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14  2:17 more fallocate fixes Ronnie Sahlberg
2019-03-14  2:17 ` [PATCH] cifs: fix fallocate(mode==0) for extending non-sparse files Ronnie Sahlberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.