linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFS: Read unlock folio on nfs_page_create_from_folio() error
@ 2024-03-05 17:30 Benjamin Coddington
  2024-03-05 18:00 ` David Wysochanski
  2024-03-07 14:41 ` [PATCH RESEND] " Benjamin Coddington
  0 siblings, 2 replies; 3+ messages in thread
From: Benjamin Coddington @ 2024-03-05 17:30 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, Dave Wysochanski

The netfs conversion lost a folio_unlock() for the case where
nfs_page_create_from_folio() returns an error (usually -ENOMEM).  Restore
it.

Reported-by: David Jeffery <djeffery@redhat.com>
Cc: <stable@vger.kernel.org> # 6.4+
Fixes: 000dbe0bec05 ("NFS: Convert buffered read paths to use netfs when fscache is enabled")
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---
 fs/nfs/read.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 7dc21a48e3e7..a142287d86f6 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -305,6 +305,8 @@ int nfs_read_add_folio(struct nfs_pageio_descriptor *pgio,
 	new = nfs_page_create_from_folio(ctx, folio, 0, aligned_len);
 	if (IS_ERR(new)) {
 		error = PTR_ERR(new);
+		if (nfs_netfs_folio_unlock(folio))
+			folio_unlock(folio);
 		goto out;
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] NFS: Read unlock folio on nfs_page_create_from_folio() error
  2024-03-05 17:30 [PATCH] NFS: Read unlock folio on nfs_page_create_from_folio() error Benjamin Coddington
@ 2024-03-05 18:00 ` David Wysochanski
  2024-03-07 14:41 ` [PATCH RESEND] " Benjamin Coddington
  1 sibling, 0 replies; 3+ messages in thread
From: David Wysochanski @ 2024-03-05 18:00 UTC (permalink / raw)
  To: Benjamin Coddington; +Cc: Trond Myklebust, Anna Schumaker, linux-nfs

On Tue, Mar 5, 2024 at 12:30 PM Benjamin Coddington <bcodding@redhat.com> wrote:
>
> The netfs conversion lost a folio_unlock() for the case where
> nfs_page_create_from_folio() returns an error (usually -ENOMEM).  Restore
> it.
>
> Reported-by: David Jeffery <djeffery@redhat.com>
> Cc: <stable@vger.kernel.org> # 6.4+
> Fixes: 000dbe0bec05 ("NFS: Convert buffered read paths to use netfs when fscache is enabled")
> Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
> ---
>  fs/nfs/read.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/fs/nfs/read.c b/fs/nfs/read.c
> index 7dc21a48e3e7..a142287d86f6 100644
> --- a/fs/nfs/read.c
> +++ b/fs/nfs/read.c
> @@ -305,6 +305,8 @@ int nfs_read_add_folio(struct nfs_pageio_descriptor *pgio,
>         new = nfs_page_create_from_folio(ctx, folio, 0, aligned_len);
>         if (IS_ERR(new)) {
>                 error = PTR_ERR(new);
> +               if (nfs_netfs_folio_unlock(folio))
> +                       folio_unlock(folio);
>                 goto out;
>         }
>
> --
> 2.43.0
>


Acked-by: Dave Wysochanski <dwysocha@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH RESEND] NFS: Read unlock folio on nfs_page_create_from_folio() error
  2024-03-05 17:30 [PATCH] NFS: Read unlock folio on nfs_page_create_from_folio() error Benjamin Coddington
  2024-03-05 18:00 ` David Wysochanski
@ 2024-03-07 14:41 ` Benjamin Coddington
  1 sibling, 0 replies; 3+ messages in thread
From: Benjamin Coddington @ 2024-03-07 14:41 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, Dave Wysochanski

The netfs conversion lost a folio_unlock() for the case where
nfs_page_create_from_folio() returns an error (usually -ENOMEM).  Restore
it.

Reported-by: David Jeffery <djeffery@redhat.com>
Cc: <stable@vger.kernel.org> # 6.4+
Fixes: 000dbe0bec05 ("NFS: Convert buffered read paths to use netfs when fscache is enabled")
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
---

Resending this as I messed up Trond's email address on the first try:
https://lore.kernel.org/linux-nfs/CALF+zOn50xfKDBxqG1JfWVcRa+PvMvMpcWYfJmt0FWoUe0mW5w@mail.gmail.com/T/#t

---
 fs/nfs/read.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 7dc21a48e3e7..a142287d86f6 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -305,6 +305,8 @@ int nfs_read_add_folio(struct nfs_pageio_descriptor *pgio,
 	new = nfs_page_create_from_folio(ctx, folio, 0, aligned_len);
 	if (IS_ERR(new)) {
 		error = PTR_ERR(new);
+		if (nfs_netfs_folio_unlock(folio))
+			folio_unlock(folio);
 		goto out;
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-07 14:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-05 17:30 [PATCH] NFS: Read unlock folio on nfs_page_create_from_folio() error Benjamin Coddington
2024-03-05 18:00 ` David Wysochanski
2024-03-07 14:41 ` [PATCH RESEND] " Benjamin Coddington

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).