* [PATCH] NFS/localio: fix nfs_local_dio_misaligned tracepoint
@ 2026-07-08 21:36 Mike Snitzer
2026-07-21 13:56 ` Anna Schumaker
0 siblings, 1 reply; 3+ messages in thread
From: Mike Snitzer @ 2026-07-08 21:36 UTC (permalink / raw)
To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs
The intended focus of nfs_local_iters_setup_dio()'s call to
trace_nfs_local_dio_misaligned() is on the middle segment being
misaligned, yet the @offset passed in was local_dio->start_len.
It would appear this was a cut-n-paste bug from the preceding
nfs_local_iter_setup() call that passes local_dio->start_len.
Fix this by passing the @offset as local_dio->middle_offset and
calculate the start segment's offset rather than assume.
Example traces, before this fix:
python3-32744 [006] .l... 132946.352360:
nfs_local_dio_write: fileid=00:33:1286 fhandle=0xf1f7c10b
offset=1048759 count=1048576 mem_align=4 offset_align=512
start=1048759+329 middle=1049088+1048064 end=2097152+183
python3-32744 [006] .l... 132946.352360:
nfs_local_dio_misaligned: fileid=00:33:1286 fhandle=0xf1f7c10b
offset=329 count=1048064 mem_align=4 offset_align=512
start=329+329 middle=1049088+1048064 end=2097152+183
After this fix:
python3-32744 [006] .l... 132946.352360:
nfs_local_dio_write: fileid=00:33:1286 fhandle=0xf1f7c10b
offset=1048759 count=1048576 mem_align=4 offset_align=512
start=1048759+329 middle=1049088+1048064 end=2097152+183
python3-32744 [006] .l... 132946.352360:
nfs_local_dio_misaligned: fileid=00:33:1286 fhandle=0xf1f7c10b
offset=1049088 count=1048064 mem_align=4 offset_align=512
start=1048759+329 middle=1049088+1048064 end=2097152+183
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
---
fs/nfs/localio.c | 2 +-
fs/nfs/nfstrace.h | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/localio.c b/fs/nfs/localio.c
index f42b6112a613..63c38dea50cc 100644
--- a/fs/nfs/localio.c
+++ b/fs/nfs/localio.c
@@ -446,7 +446,7 @@ nfs_local_iters_setup_dio(struct nfs_local_kiocb *iocb, int rw,
if (unlikely(!iocb->iter_is_dio_aligned[n_iters])) {
trace_nfs_local_dio_misaligned(iocb->hdr->inode,
- local_dio->start_len, local_dio->middle_len, local_dio);
+ local_dio->middle_offset, local_dio->middle_len, local_dio);
return 0; /* no DIO-aligned IO possible */
}
iocb->end_iter_index = n_iters;
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index c70debb88aa1..2e1932962a81 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -1772,7 +1772,10 @@ DECLARE_EVENT_CLASS(nfs_local_dio_class,
__entry->count = count;
__entry->mem_align = local_dio->mem_align;
__entry->offset_align = local_dio->offset_align;
- __entry->start = offset;
+ if (local_dio->start_len)
+ __entry->start = local_dio->middle_offset - local_dio->start_len;
+ else
+ __entry->start = 0;
__entry->start_len = local_dio->start_len;
__entry->middle = local_dio->middle_offset;
__entry->middle_len = local_dio->middle_len;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] NFS/localio: fix nfs_local_dio_misaligned tracepoint
2026-07-08 21:36 [PATCH] NFS/localio: fix nfs_local_dio_misaligned tracepoint Mike Snitzer
@ 2026-07-21 13:56 ` Anna Schumaker
2026-08-12 22:13 ` Mike Snitzer
0 siblings, 1 reply; 3+ messages in thread
From: Anna Schumaker @ 2026-07-21 13:56 UTC (permalink / raw)
To: Mike Snitzer, Trond Myklebust; +Cc: linux-nfs
Hi Mike,
On Wed, Jul 8, 2026, at 5:36 PM, Mike Snitzer wrote:
> The intended focus of nfs_local_iters_setup_dio()'s call to
> trace_nfs_local_dio_misaligned() is on the middle segment being
> misaligned, yet the @offset passed in was local_dio->start_len.
> It would appear this was a cut-n-paste bug from the preceding
> nfs_local_iter_setup() call that passes local_dio->start_len.
>
> Fix this by passing the @offset as local_dio->middle_offset and
> calculate the start segment's offset rather than assume.
>
> Example traces, before this fix:
>
> python3-32744 [006] .l... 132946.352360:
> nfs_local_dio_write: fileid=00:33:1286 fhandle=0xf1f7c10b
> offset=1048759 count=1048576 mem_align=4 offset_align=512
> start=1048759+329 middle=1049088+1048064 end=2097152+183
>
> python3-32744 [006] .l... 132946.352360:
> nfs_local_dio_misaligned: fileid=00:33:1286 fhandle=0xf1f7c10b
> offset=329 count=1048064 mem_align=4 offset_align=512
> start=329+329 middle=1049088+1048064 end=2097152+183
>
> After this fix:
>
> python3-32744 [006] .l... 132946.352360:
> nfs_local_dio_write: fileid=00:33:1286 fhandle=0xf1f7c10b
> offset=1048759 count=1048576 mem_align=4 offset_align=512
> start=1048759+329 middle=1049088+1048064 end=2097152+183
>
> python3-32744 [006] .l... 132946.352360:
> nfs_local_dio_misaligned: fileid=00:33:1286 fhandle=0xf1f7c10b
> offset=1049088 count=1048064 mem_align=4 offset_align=512
> start=1048759+329 middle=1049088+1048064 end=2097152+183
>
> Cc: stable@vger.kernel.org
Do you have a fixes tag for this commit?
Thanks,
Anna
> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
> ---
> fs/nfs/localio.c | 2 +-
> fs/nfs/nfstrace.h | 5 ++++-
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfs/localio.c b/fs/nfs/localio.c
> index f42b6112a613..63c38dea50cc 100644
> --- a/fs/nfs/localio.c
> +++ b/fs/nfs/localio.c
> @@ -446,7 +446,7 @@ nfs_local_iters_setup_dio(struct nfs_local_kiocb
> *iocb, int rw,
>
> if (unlikely(!iocb->iter_is_dio_aligned[n_iters])) {
> trace_nfs_local_dio_misaligned(iocb->hdr->inode,
> - local_dio->start_len, local_dio->middle_len, local_dio);
> + local_dio->middle_offset, local_dio->middle_len, local_dio);
> return 0; /* no DIO-aligned IO possible */
> }
> iocb->end_iter_index = n_iters;
> diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
> index c70debb88aa1..2e1932962a81 100644
> --- a/fs/nfs/nfstrace.h
> +++ b/fs/nfs/nfstrace.h
> @@ -1772,7 +1772,10 @@ DECLARE_EVENT_CLASS(nfs_local_dio_class,
> __entry->count = count;
> __entry->mem_align = local_dio->mem_align;
> __entry->offset_align = local_dio->offset_align;
> - __entry->start = offset;
> + if (local_dio->start_len)
> + __entry->start = local_dio->middle_offset - local_dio->start_len;
> + else
> + __entry->start = 0;
> __entry->start_len = local_dio->start_len;
> __entry->middle = local_dio->middle_offset;
> __entry->middle_len = local_dio->middle_len;
> --
> 2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: NFS/localio: fix nfs_local_dio_misaligned tracepoint
2026-07-21 13:56 ` Anna Schumaker
@ 2026-08-12 22:13 ` Mike Snitzer
0 siblings, 0 replies; 3+ messages in thread
From: Mike Snitzer @ 2026-08-12 22:13 UTC (permalink / raw)
To: Anna Schumaker; +Cc: Trond Myklebust, linux-nfs
On Tue, Jul 21, 2026 at 09:56:33AM -0400, Anna Schumaker wrote:
> Hi Mike,
>
> On Wed, Jul 8, 2026, at 5:36 PM, Mike Snitzer wrote:
> > The intended focus of nfs_local_iters_setup_dio()'s call to
> > trace_nfs_local_dio_misaligned() is on the middle segment being
> > misaligned, yet the @offset passed in was local_dio->start_len.
> > It would appear this was a cut-n-paste bug from the preceding
> > nfs_local_iter_setup() call that passes local_dio->start_len.
> >
> > Fix this by passing the @offset as local_dio->middle_offset and
> > calculate the start segment's offset rather than assume.
> >
> > Example traces, before this fix:
> >
> > python3-32744 [006] .l... 132946.352360:
> > nfs_local_dio_write: fileid=00:33:1286 fhandle=0xf1f7c10b
> > offset=1048759 count=1048576 mem_align=4 offset_align=512
> > start=1048759+329 middle=1049088+1048064 end=2097152+183
> >
> > python3-32744 [006] .l... 132946.352360:
> > nfs_local_dio_misaligned: fileid=00:33:1286 fhandle=0xf1f7c10b
> > offset=329 count=1048064 mem_align=4 offset_align=512
> > start=329+329 middle=1049088+1048064 end=2097152+183
> >
> > After this fix:
> >
> > python3-32744 [006] .l... 132946.352360:
> > nfs_local_dio_write: fileid=00:33:1286 fhandle=0xf1f7c10b
> > offset=1048759 count=1048576 mem_align=4 offset_align=512
> > start=1048759+329 middle=1049088+1048064 end=2097152+183
> >
> > python3-32744 [006] .l... 132946.352360:
> > nfs_local_dio_misaligned: fileid=00:33:1286 fhandle=0xf1f7c10b
> > offset=1049088 count=1048064 mem_align=4 offset_align=512
> > start=1048759+329 middle=1049088+1048064 end=2097152+183
> >
> > Cc: stable@vger.kernel.org
>
> Do you have a fixes tag for this commit?
>
> Thanks,
> Anna
Sorry, I somehow missed this until now. Looks to be:
Fixes: 6a218b9c3183e ("nfs/localio: do not issue misaligned DIO out-of-order")
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-12 22:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 21:36 [PATCH] NFS/localio: fix nfs_local_dio_misaligned tracepoint Mike Snitzer
2026-07-21 13:56 ` Anna Schumaker
2026-08-12 22:13 ` Mike Snitzer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox