Commit d84c4754 authored by Sergey Bashirov's avatar Sergey Bashirov Committed by Trond Myklebust
Browse files

pNFS: Fix extent encoding in block/scsi layout



The ext_tree_encode_commit() function may be called multiple times for
the same file, layout, and last written byte if the provided buffer is
not large enough to encode all extents in it.

The first problem is that the last written byte field must be zeroed
only on a successful call, otherwise we will lose its actual value and
get an integer overflow on the next encoding attempt.

The second problem is that we can't count and encode in one pass. The
extent state changes during encoding, so if we return -ENOSPC but have
already encoded some extents into a small buffer, they will not be
re-encoded into a new larger buffer on the next try. As a result, the
client never commits these extents to the server.

Co-developed-by: default avatarKonstantin Evtushenko <koevtushenko@yandex.com>
Signed-off-by: default avatarKonstantin Evtushenko <koevtushenko@yandex.com>
Signed-off-by: default avatarSergey Bashirov <sergeybashirov@gmail.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250630183537.196479-3-sergeybashirov@gmail.com


Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 9768797c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment