From: "Namjae Jeon" <namjae.jeon@samsung.com>
To: "'Leif Sahlberg'" <lsahlber@redhat.com>
Cc: <linux-cifs@vger.kernel.org>
Subject: RE: [PATCH] cifs: only write 64kb at a time when fallocating a small region of a file
Date: Thu, 22 Jul 2021 15:54:29 +0900 [thread overview]
Message-ID: <006601d77ec6$6b1b13c0$41513b40$@samsung.com> (raw)
In-Reply-To: <CAGvGhF55Tq-sLUtKBn+QX6kWrL9dDzKkXFKdQ==gz3s=RkySKQ@mail.gmail.com>
> This code is actually bogus and does the opposite of what the comment says.
> If out_data_len is 0 then that means that the entire region is unallocated and then we should not
> bail out but proceed and allocate the hole.
> generic/071 works against a windows server for me.
> If it fails with this code removed it might mean that generic/071 never worked with cifs.ko correctly.
generic/071 create preallocated extent by calling fallocate with keep size flags.
It means the file size should not be increased.
But if (out_buf_len == 0) check is removed, 1MB write is performed using SMB2_write loop().
It means the file size becomes 1MB.
And then, generic/071 call again fallocate(0, 512K) which mean file size should be 512K.
but SMB2_set_eof() in cifs is not called due to the code below(->i_size is bigger than off + len),
So 071 test failed as file size remains 1MB.
/*
* Extending the file
*/
if ((keep_size == false) && i_size_read(inode) < off + len) {
rc = inode_newsize_ok(inode, off + len);
if (rc)
goto out;
if ((cifsi->cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE) == 0)
smb2_set_sparse(xid, tcon, cfile, inode, false);
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 == 0) {
cifsi->server_eof = off + len;
cifs_setsize(inode, off + len);
cifs_truncate_page(inode->i_mapping, inode->i_size);
truncate_setsize(inode, off + len);
}
goto out;
}
next prev parent reply other threads:[~2021-07-22 6:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210721015429epcas1p4654c2b9348101aa7967bfe60d1d8da71@epcas1p4.samsung.com>
[not found] ` <014c01d77dd3$57add320$07097960$@samsung.com>
2021-07-21 7:21 ` [PATCH] cifs: only write 64kb at a time when fallocating a small region of a file Namjae Jeon
[not found] ` <CAGvGhF55Tq-sLUtKBn+QX6kWrL9dDzKkXFKdQ==gz3s=RkySKQ@mail.gmail.com>
2021-07-22 6:54 ` Namjae Jeon [this message]
2021-07-22 7:17 ` ronnie sahlberg
2021-07-22 7:22 ` Namjae Jeon
2021-07-22 16:44 ` Steve French
2021-07-22 4:53 Ronnie Sahlberg
-- strict thread matches above, loose matches on Subject: below --
2021-07-21 0:50 Ronnie Sahlberg
2021-07-21 0:49 Ronnie Sahlberg
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='006601d77ec6$6b1b13c0$41513b40$@samsung.com' \
--to=namjae.jeon@samsung.com \
--cc=linux-cifs@vger.kernel.org \
--cc=lsahlber@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox