Skip to contentSkip to conversation

file truncation on newer linux-cifs versions

DISCUSSION Mirko Scholz 3 participants 7 messages Jan 13, 2012 – Jan 15, 2012 8 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

with linux' cifs implementation I experience file truncation when talking to our institute's file server [1]

% rm -f zero*
% dd if=/dev/zero of=test-64 bs=64k count=1
% dd if=/dev/zero of=test-65 bs=65k count=1
dd: closing output file `test-65': No space left on device i.e. close(2) returns ENOSPC
% ls -l test*
-rw------- 1 65536 Jan 13 22:43 test-64
-rw------- 1 65536 Jan 13 22:43 test-65

The problem does not occur in Debian Squeeze (confirmed with vanilla v2.6.32). Also checked with our IT guys that there is no real quota applied. The above error occurs in current Testing [2] (i.e. patched 3.1.0 and current vanilla HEAD v3.2.0+).

I haven't seen anything suspicious in a tcpdump (I mean the Close Response, which I guess should be responsible for the quota right?, looks similar). The dmesg with echo 7 > /proc/fs/cifs/cifsFYI for both cases you may find at http://www.gwdg.de/~mscholz5/cifs-problem/3.0.0+
(from a run of git bisect I am currently in it is from a v3.0.0+)

I'd appreciate any suggestions for additional information you might need

Mirko

[1] OS=[BlueArc Mercury 8.1.2350.22] Server=[BlueArc Mercury 8.1.2350.22] mounted via mount.cifs
[2] mount.cifs version: 5.2

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Generally would be useful to see a wireshark trace so we can compare the log output with it - and the version of the cifs kernel client (kernel version "cat /proc/version" and/or modinfo cifs.ko to show the cifs version) and server version - on the client "cat /proc/fs/cifs/DebugData should show the server version which it
reported on the session establishment). May be useful to track this
info in samba bugzilla in cifsfs component if you verify the bug is real.

Quoted 39 lines · Mirko Scholz

Hello,

with linux' cifs implementation I experience file truncation when talking to our institute's file server [1]

% rm -f zero*
% dd if=/dev/zero of=test-64 bs=64k count=1
% dd if=/dev/zero of=test-65 bs=65k count=1
dd: closing output file `test-65': No space left on device i.e. close(2) returns ENOSPC
% ls -l test*

(quoted diff) +0 -2
-rw------- 1   65536 Jan 13 22:43 test-64
-rw------- 1   65536 Jan 13 22:43 test-65

The problem does not occur in Debian Squeeze (confirmed with vanilla v2.6.32).  Also checked with our IT guys that there is no real quota applied.  The above error occurs in current Testing [2] (i.e. patched 3.1.0 and current vanilla HEAD v3.2.0+).

I haven't seen anything suspicious in a tcpdump (I mean the Close Response, which I guess should be responsible for the quota right?, looks similar).  The dmesg with echo 7 > /proc/fs/cifs/cifsFYI for both cases you may find at http://www.gwdg.de/~mscholz5/cifs-problem/3.0.0+
(from a run of git bisect I am currently in it is from a v3.0.0+)

I'd appreciate any suggestions for additional information you might need

Mirko

[1] OS=[BlueArc Mercury 8.1.2350.22] Server=[BlueArc Mercury 8.1.2350.22] mounted via mount.cifs
[2] mount.cifs version: 5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Thanks,

Steve

A message that is not in the archive (sent off-list or not yet received): CAOhYWN+dLLKXs6MU3W88oHzyFgi1KV+7oh1qPh61ZEqUA-Jw8w@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): CAOhYWN+dLLKXs6MU3W88oHzyFgi1KV+7oh1qPh61ZEqUA-Jw8w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw
Quoted 4 lines

Does the problem go away if you mount with wsize=65535? If so, I guess we can add bluearc to the list of servers that can't handle writes larger than windows sends.

yes it does. Thanks for pointing it out, as it is clearly mentioned in mount.cifs(8). But it says, that this size is negotiated...?

Quoted 2 lines

Steve is right though that a capture would be helpful to confirm what's happening.

You'll find it at http://www.gwdg.de/~mscholz5/cifs-problem/v3.1.0-1

Thank you both for the quick reply. I noticed this problem a while ago, but hasitated to report it, since cifs is not officially supported at my site.

Steve, do you still need the bug-report?

Mirko

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 7 lines · On Sat, 14 Jan 2012 14:50:58 +0100 Mirko Scholz…
Quoted 4 lines

Does the problem go away if you mount with wsize=65535? If so, I guess we can add bluearc to the list of servers that can't handle writes larger than windows sends.

yes it does. Thanks for pointing it out, as it is clearly mentioned in mount.cifs(8). But it says, that this size is negotiated...?

To a degree...

We attempt to set the wsize according to what the server supports, but there is no way for the server to say "I only support writes up to this size". Currently, when the server says it supports large writes, we attempt to set the wsize as large as we can go -- ~127k or so.

Windows servers support that just fine, but windows clients never send writes larger thank 64k. Unfortunately, some servers are not engineered to handle larger writes, and only handle up to what windows clients default to.

I sent a patch a while back to set the default wsize to match what windows does, but Steve has so far refused to take it.

Quoted 11 lines
Quoted 2 lines

Steve is right though that a capture would be helpful to confirm what's happening.

You'll find it at http://www.gwdg.de/~mscholz5/cifs-problem/v3.1.0-1

Thank you both for the quick reply. I noticed this problem a while ago, but hasitated to report it, since cifs is not officially supported at my site.

Steve, do you still need the bug-report?

Thanks -- there's probably no need for a bug report. I think I understand the problem. You can probably set wsize=65536, actually and it should still work.

The server is responding to a 66560 byte write with a length of 65536. The current code treats a short write like an -ENOSPC error. It's not ideal, but the spec doesn't really spell out what a short write means, and it would be quite difficult to try to recover from this situation gracefully.

Steve, the list of servers that do not support >64k writes is growing. Are you ready to take my patch to set the default wsize lower yet?

Signature · 1 line
Jeff Layton <[email protected]>

A message that is not in the archive (sent off-list or not yet received): 20120114093322.7e36221d-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org

#9 lore raw

Can you experiment a little with setting different wsize values and see if the server's bug starts at exactly 64K, or as we saw with another server ~100K. There is significant performance benefit in setting the wsize to larger than 64K, but if we find a second server that maxes at ~100K we may want to set it to that. I still would prefer to workaround buggy servers if it were possible to recognize them because I hate to punish (with 20%+ or more worse write performance) the vast majority of servers (Windows,Samba, NetApp) for the bug of a few. Obviously if the problem with the server can not be recognized then we may have to reset wsize - I still would generally prefer (at least for the Solaris case where the server does report an error) to handle the write error and alter the write size for subsequent writes - but as Jeff noted in earlier discussion, although possible, it is a harder patch to do. I would be curious though if your server gives any indication of write error or silently ignores the large write.

Quoted 53 lines · Jeff Layton
Quoted 7 lines · On Sat, 14 Jan 2012 14:50:58 +0100 Mirko Scholz…
Quoted 4 lines

Does the problem go away if you mount with wsize=65535? If so, I guess we can add bluearc to the list of servers that can't handle writes larger than windows sends.

yes it does.  Thanks for pointing it out, as it is clearly mentioned in mount.cifs(8).  But it says, that this size is negotiated...?

To a degree...

We attempt to set the wsize according to what the server supports, but there is no way for the server to say "I only support writes up to this size". Currently, when the server says it supports large writes, we attempt to set the wsize as large as we can go -- ~127k or so.

Windows servers support that just fine, but windows clients never send writes larger thank 64k. Unfortunately, some servers are not engineered to handle larger writes, and only handle up to what windows clients default to.

I sent a patch a while back to set the default wsize to match what windows does, but Steve has so far refused to take it.

Quoted 11 lines
Quoted 2 lines

Steve is right though that a capture would be helpful to confirm what's happening.

You'll find it at http://www.gwdg.de/~mscholz5/cifs-problem/v3.1.0-1

Thank you both for the quick reply.  I noticed this problem a while ago, but hasitated to report it, since cifs is not officially supported at my site.

Steve, do you still need the bug-report?

Thanks -- there's probably no need for a bug report. I think I understand the problem. You can probably set wsize=65536, actually and it should still work.

The server is responding to a 66560 byte write with a length of 65536. The current code treats a short write like an -ENOSPC error. It's not ideal, but the spec doesn't really spell out what a short write means, and it would be quite difficult to try to recover from this situation gracefully.

Steve, the list of servers that do not support >64k writes is growing. Are you ready to take my patch to set the default wsize lower yet?

--
Jeff Layton <[email protected]>

Signature · 3 lines
Thanks,

Steve

A message that is not in the archive (sent off-list or not yet received): CAH2r5ms9wfz_3dGeCLJ7bvXeKeerSEfFpbiTz6C_WdPbFk6WXA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#11 lore raw
Quoted 3 lines · Steve French

Can you experiment a little with setting different wsize values and see if the server's bug starts at exactly 64K, or as we saw with another server ~100K.

Wouldn't the -ENOSPC not appear at that size? Anyways I tried 68k, 80k and 100k, the problem of truncation remains.

Quoted 8 lines

There is significant performance benefit in setting the wsize to larger than 64K, but if we find a second server that maxes at ~100K we may want to set it to that.

I still would prefer to workaround buggy servers if it were possible to recognize them because I hate to punish (with 20%+ or more worse write performance) the vast majority of servers (Windows,Samba, NetApp) for the bug of a few.

IMHO there are a couple of alternatives, that do not punish other servers:

educate your users, as

* while elevated logging display a warning when encountering a short write. Just that someone without deeper CIFS knowledge gets a hint.

I just didn't follow linux-cifs and haven't been aware of the wsize option at all, sorry.

or do the workaround

* during negotiation log something like "detected buggy/sub-performant server, setting wsize to known safe 65536" as at least one NIC driver did

* go with 64k as default and have a white list of performant servers

Whether you black or white list depends entirely which list is expected to be more definitive, doesn't it? As I have no clue how many different CIFS servers there are, the white list sounds more rational to me. But our setup may be a bit special anyways because Blue Arc supports NFS exports. IT dept. only objects against shared access.

Quoted 2 lines

I would be curious though if your server gives any indication of write error or silently ignores the large write.

Expect an answer during next week. I myself cannot obtain such information.

Mirko

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw
Quoted 4 lines · On Sat, 14 Jan 2012 16:30:41 +0100 Mirko Scholz…
Quoted 3 lines

To a degree...

[...]

Quoted 8 lines

Thanks for the information. And sorry that you must repeat yourself. It is actually the same as
https://bugzilla.samba.org/show_bug.cgi?id=8559

Maybe one should add "Try again using wsize=65536" to
http://wiki.samba.org/index.php/LinuxCIFS_troubleshooting
for the time beeing.

(re-cc'ing linux-cifs)

No problem.

Not a bad idea. I'll plan to add a FAQ or known problems section or something soon.

That said, I'd prefer it if cifs.ko used a default wsize that was more or less guaranteed to work with any server in the field, and allowed people to set it higher if they know their server is able to handle it.

Signature · 1 line
Jeff Layton <[email protected]>