All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: smfrench@gmail.com
Cc: dhowells@redhat.com, Shyam Prasad N <nspmangalore@gmail.com>,
	jlayton@kernel.org, linux-cifs@vger.kernel.org
Subject: cifs fallocate doesn't flush writes?
Date: Thu, 13 Jan 2022 13:18:40 +0000	[thread overview]
Message-ID: <1828480.1642079920@warthog.procyon.org.uk> (raw)

Hi Steve,

Should cifs fallocate be flushing writes before doing the falloc?

If I do the following:

	mount //carina/test /xfstest.test -o user=shares,pass=foobar,noperm,vers=3.0,mfsymlinks,actimeo=0
	/usr/sbin/xfs_io -f -t \
		-c "pwrite -S 0x41 0 4096"
		-c "pwrite -S 0x42 4096 4096"
		-c "fzero 0 4096" \
		-c "pread 0 8192" \
		/xfstest.test/008.7067

The packet trace shows:

   25 0.289099336  192.168.6.2 -> 192.168.6.1  SMB2 414 Create Request File: ;GetInfo Request FS_INFO/FileFsFullSizeInformation;Close Request
   26 0.292164924  192.168.6.1 -> 192.168.6.2  SMB2 510 Create Response File: ;GetInfo Response;Close Response
   27 0.292444124  192.168.6.2 -> 192.168.6.1  SMB2 174 GetInfo Request FILE_INFO/SMB2_FILE_ALL_INFO File: 008.7067
   28 0.292716736  192.168.6.1 -> 192.168.6.2  SMB2 260 GetInfo Response
   29 0.293018017  192.168.6.2 -> 192.168.6.1  SMB2 414 Create Request File: ;GetInfo Request FS_INFO/FileFsFullSizeInformation;Close Request
   30 0.295730538  192.168.6.1 -> 192.168.6.2  SMB2 510 Create Response File: ;GetInfo Response;Close Response
   31 0.321638749  192.168.6.2 -> 192.168.6.1  SMB2 206 Ioctl Request FSCTL_SET_ZERO_DATA File: 008.7067
   32 0.321862497  192.168.6.1 -> 192.168.6.2  SMB2 182 Ioctl Response FSCTL_SET_ZERO_DATA File: 008.7067
   33 0.334313914  192.168.6.2 -> 192.168.6.1  SMB2 183 Read Request Len:4096 Off:0 File: 008.7067
   34 0.334772295  192.168.6.1 -> 192.168.6.2  SMB2 143 Read Response, Error: STATUS_END_OF_FILE
   35 0.357622873  192.168.6.2 -> 192.168.6.1  SMB2 183 Read Request Len:4096 Off:0 File: 008.7067
   36 0.358040997  192.168.6.1 -> 192.168.6.2  SMB2 143 Read Response, Error: STATUS_END_OF_FILE
   38 0.373614076  192.168.6.2 -> 192.168.6.1  SMB2 1382 Write Request Len:4096 Off:4096 File: 008.7067
   40 0.374142468  192.168.6.1 -> 192.168.6.2  SMB2 150 Write Response
   41 0.374485805  192.168.6.2 -> 192.168.6.1  SMB2 158 Close Request File: 008.7067
   42 0.375222020  192.168.6.1 -> 192.168.6.2  SMB2 194 Close Response

The first page read (which overlaps with the writes and fzero) returns an EOF
error.  Shouldn't the FSCTL_SET_ZERO_DATA have extended the file to 4096?
Also, I wonder what happened to the pagecache: the second read shouldn't have
happened because fallocate() shouldn't have touched that page.

Also, the writeback happens last - I wonder if fallocate should flush.  Not
that it should be necessary if it's just modifying pages already in the
pagecache.

David


             reply	other threads:[~2022-01-13 13:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 13:18 David Howells [this message]
2022-01-13 15:20 ` Incorrect fallocate behaviour in cifs or samba? David Howells
2022-01-13 17:43   ` Jeremy Allison
2022-01-13 18:16     ` David Disseldorp
2022-01-13 18:22       ` Jeremy Allison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1828480.1642079920@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=jlayton@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=nspmangalore@gmail.com \
    --cc=smfrench@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.