Skip to content

ksmbd: fix SetAllocation EOF and rounding

DaeMyung Kang linux-cifs lkml stable 1 version Applied

Status from this message: Applied them to #ksmbd-for-next.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2ksmbd: avoid restoring only in-memory EOF after allocation changefs/smb/server/smb2pdu.c+4 -110 replies
2/2ksmbd: round SetAllocation to the advertised allocation unitfs/smb/server/smb2pdu.c+20 -150 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] ksmbd: fix SetAllocation EOF and rounding

In response to Namjae's review of my earlier SetAllocation patch, this series separates two fixes. Patch 1/2 prevents the existing cleanup branch from extending EOF on disk and then restoring only the in-memory size. It carries Fixes and Cc: stable. Patch 2/2 rounds the request to f_bsize, the allocation unit ksmbd advertises in FS_SIZE_INFORMATION, instead of 512 bytes.

The other review point, reserving the requested range when shrinking, remains open. I tried fallocate before truncate, but the decision to shrink uses an EOF value read before vfs_truncate() takes inode_lock. The existing block-count branch already has this race; extending truncate to additional sparse-file cases would expose it more widely. If another client truncates and writes in that interval, our truncate can extend the file again with zeros. I reproduced this with an injected delay in QEMU. Rechecking EOF after fallocate narrows the window but does not close it.

A VFS operation that checks EOF and truncates under the same inode_lock without extending the file may be needed. I plan to discuss the reservation fix separately with linux-fsdevel and would welcome your thoughts on that approach.

DaeMyung Kang (2):
ksmbd: avoid restoring only in-memory EOF after allocation change
ksmbd: round SetAllocation to the advertised allocation unit

 fs/smb/server/smb2pdu.c | 48 ++++++++++++++++++++---------------------
 1 file changed, 23 insertions(+), 25 deletions(-)

base-commit: bf3465919b0337dfef8798da01469145887c4ef5

Signature · 1 line
2.43.0