Re: [PATCH] netfs: Fix i_size updating

From: Steve French
Date: Thu Jun 26 2025 - 10:08:22 EST


added to for-next pending testing

On Thu, Jun 26, 2025 at 8:39 AM Paulo Alcantara <pc@xxxxxxxxxxxxx> wrote:
>
> David Howells <dhowells@xxxxxxxxxx> writes:
>
> > Fix the updating of i_size, particularly in regard to the completion of DIO
> > writes and especially async DIO writes by using a lock.
> >
> > The bug is triggered occasionally by the generic/207 xfstest as it chucks a
> > bunch of AIO DIO writes at the filesystem and then checks that fstat()
> > returns a reasonable st_size as each completes.
> >
> > The problem is that netfs is trying to do "if new_size > inode->i_size,
> > update inode->i_size" sort of thing but without a lock around it.
> >
> > This can be seen with cifs, but shouldn't be seen with kafs because kafs
> > serialises modification ops on the client whereas cifs sends the requests
> > to the server as they're generated and lets the server order them.
> >
> > Fixes: 153a9961b551 ("netfs: Implement unbuffered/DIO write support")
> > Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
> > cc: Steve French <sfrench@xxxxxxxxx>
> > cc: Paulo Alcantara <pc@xxxxxxxxxxxxx>
> > cc: linux-cifs@xxxxxxxxxxxxxxx
> > cc: netfs@xxxxxxxxxxxxxxx
> > cc: linux-fsdevel@xxxxxxxxxxxxxxx
> > ---
> > fs/netfs/buffered_write.c | 2 ++
> > fs/netfs/direct_write.c | 8 ++++++--
> > 2 files changed, 8 insertions(+), 2 deletions(-)
>
> Reviewed-by: Paulo Alcantara (Red Hat) <pc@xxxxxxxxxxxxx>
>


--
Thanks,

Steve