From: Dominique Martinet <asmadeus@codewreck.org>
To: David Howells <dhowells@redhat.com>
Cc: Christian Brauner <christian@brauner.io>,
Eric Van Hensbergen <ericvh@kernel.org>,
Jeff Layton <jlayton@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
netfs@lists.linux.dev, linux-afs@lists.infradead.org,
linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org,
ceph-devel@vger.kernel.org, v9fs@lists.linux.dev,
linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux_oss@crudebyte.com
Subject: Re: [PATCH 2/2] netfs: Fix missing zero-length check in unbuffered write
Date: Wed, 31 Jan 2024 06:57:23 +0900 [thread overview]
Message-ID: <Zblww5O_bRvKx36g@codewreck.org> (raw)
In-Reply-To: <20240129094924.1221977-3-dhowells@redhat.com>
David Howells wrote on Mon, Jan 29, 2024 at 09:49:19AM +0000:
> Fix netfs_unbuffered_write_iter() to return immediately if
> generic_write_checks() returns 0, indicating there's nothing to write.
> Note that netfs_file_write_iter() already does this.
>
> Also, whilst we're at it, put in checks for the size being zero before we
> even take the locks. Note that generic_write_checks() can still reduce the
> size to zero, so we still need that check.
>
> Without this, a warning similar to the following is logged to dmesg:
>
> netfs: Zero-sized write [R=1b6da]
>
> and the syscall fails with EIO, e.g.:
>
> /sbin/ldconfig.real: Writing of cache extension data failed: Input/output error
>
> This can be reproduced on 9p by:
>
> xfs_io -f -c 'pwrite 0 0' /xfstest.test/foo
>
> Fixes: 153a9961b551 ("netfs: Implement unbuffered/DIO write support")
> Reported-by: Eric Van Hensbergen <ericvh@kernel.org>
> Link: https://lore.kernel.org/r/ZbQUU6QKmIftKsmo@FV7GG9FTHL/
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Dominique Martinet <asmadeus@codewreck.org>
Thanks!
Tested-by: Dominique Martinet <asmadeus@codewreck.org>
--
Dominique Martinet | Asmadeus
WARNING: multiple messages have this Message-ID (diff)
From: Dominique Martinet <asmadeus@codewreck.org>
To: David Howells <dhowells@redhat.com>
Cc: linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org,
v9fs@lists.linux.dev, linux_oss@crudebyte.com,
Jeff Layton <jlayton@kernel.org>,
linux-kernel@vger.kernel.org,
Matthew Wilcox <willy@infradead.org>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
netfs@lists.linux.dev, ceph-devel@vger.kernel.org,
Eric Van Hensbergen <ericvh@kernel.org>,
linux-erofs@lists.ozlabs.org, linux-afs@lists.infradead.org,
Christian Brauner <christian@brauner.io>
Subject: Re: [PATCH 2/2] netfs: Fix missing zero-length check in unbuffered write
Date: Wed, 31 Jan 2024 06:57:23 +0900 [thread overview]
Message-ID: <Zblww5O_bRvKx36g@codewreck.org> (raw)
In-Reply-To: <20240129094924.1221977-3-dhowells@redhat.com>
David Howells wrote on Mon, Jan 29, 2024 at 09:49:19AM +0000:
> Fix netfs_unbuffered_write_iter() to return immediately if
> generic_write_checks() returns 0, indicating there's nothing to write.
> Note that netfs_file_write_iter() already does this.
>
> Also, whilst we're at it, put in checks for the size being zero before we
> even take the locks. Note that generic_write_checks() can still reduce the
> size to zero, so we still need that check.
>
> Without this, a warning similar to the following is logged to dmesg:
>
> netfs: Zero-sized write [R=1b6da]
>
> and the syscall fails with EIO, e.g.:
>
> /sbin/ldconfig.real: Writing of cache extension data failed: Input/output error
>
> This can be reproduced on 9p by:
>
> xfs_io -f -c 'pwrite 0 0' /xfstest.test/foo
>
> Fixes: 153a9961b551 ("netfs: Implement unbuffered/DIO write support")
> Reported-by: Eric Van Hensbergen <ericvh@kernel.org>
> Link: https://lore.kernel.org/r/ZbQUU6QKmIftKsmo@FV7GG9FTHL/
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Dominique Martinet <asmadeus@codewreck.org>
Thanks!
Tested-by: Dominique Martinet <asmadeus@codewreck.org>
--
Dominique Martinet | Asmadeus
next prev parent reply other threads:[~2024-01-30 21:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-29 9:49 [PATCH 0/2] netfs: Miscellaneous fixes David Howells
2024-01-29 9:49 ` David Howells
2024-01-29 9:49 ` [PATCH 1/2] netfs: Fix i_dio_count leak on DIO read past i_size David Howells
2024-01-29 9:49 ` David Howells
2024-01-29 12:41 ` Jeff Layton
2024-01-29 12:41 ` Jeff Layton
2024-01-29 9:49 ` [PATCH 2/2] netfs: Fix missing zero-length check in unbuffered write David Howells
2024-01-29 9:49 ` David Howells
2024-01-29 12:43 ` Jeff Layton
2024-01-29 12:43 ` Jeff Layton
2024-01-30 21:57 ` Dominique Martinet [this message]
2024-01-30 21:57 ` Dominique Martinet
2024-02-19 8:38 ` Linux regression tracking (Thorsten Leemhuis)
2024-02-19 8:38 ` Linux regression tracking (Thorsten Leemhuis)
2024-02-20 9:51 ` Christian Brauner
2024-02-20 9:51 ` Christian Brauner
2024-01-29 13:53 ` [PATCH 0/2] netfs: Miscellaneous fixes Christian Brauner
2024-01-29 13:53 ` Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zblww5O_bRvKx36g@codewreck.org \
--to=asmadeus@codewreck.org \
--cc=ceph-devel@vger.kernel.org \
--cc=christian@brauner.io \
--cc=dhowells@redhat.com \
--cc=ericvh@kernel.org \
--cc=jlayton@kernel.org \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux_oss@crudebyte.com \
--cc=netfs@lists.linux.dev \
--cc=v9fs@lists.linux.dev \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.