linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Brian Geffon <bgeffon@google.com>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	 Richard Chang <richardycc@google.com>,
	linux-block@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] zram: propagate read_from_bdev_async() errors
Date: Mon, 16 Mar 2026 11:22:57 +0900	[thread overview]
Message-ID: <CADyq12xB7zpZq9xTe1sJa2O+dv1e3pbdJjWrTcpagRbGC1MfWQ@mail.gmail.com> (raw)
In-Reply-To: <20260316015354.114465-1-senozhatsky@chromium.org>

On Mon, Mar 16, 2026 at 10:54 AM Sergey Senozhatsky
<senozhatsky@chromium.org> wrote:
>
> When read_from_bdev_async() fails to chain bio, for instance
> fails to allocate request or bio, we need to propagate the
> error condition so that upper layer is aware of it.  zram
> already does that by setting BLK_STS_IOERR ->bi_status,
> but only for sync reads.  Change async read path to return
> its error status so that async errors are also handled.
>
> Suggested-by: Brian Geffon <bgeffon@google.com>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: Brian Geffon <bgeffon@google.com>

> ---
>  drivers/block/zram/zram_drv.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index 63f71371a7e9..b47cb1d99144 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -1445,21 +1445,21 @@ static void zram_async_read_endio(struct bio *bio)
>         queue_work(system_highpri_wq, &req->work);
>  }
>
> -static void read_from_bdev_async(struct zram *zram, struct page *page,
> -                                u32 index, unsigned long blk_idx,
> -                                struct bio *parent)
> +static int read_from_bdev_async(struct zram *zram, struct page *page,
> +                               u32 index, unsigned long blk_idx,
> +                               struct bio *parent)
>  {
>         struct zram_rb_req *req;
>         struct bio *bio;
>
>         req = kmalloc_obj(*req, GFP_NOIO);
>         if (!req)
> -               return;
> +               return -ENOMEM;
>
>         bio = bio_alloc(zram->bdev, 1, parent->bi_opf, GFP_NOIO);
>         if (!bio) {
>                 kfree(req);
> -               return;
> +               return -ENOMEM;
>         }
>
>         req->zram = zram;
> @@ -1475,6 +1475,8 @@ static void read_from_bdev_async(struct zram *zram, struct page *page,
>         __bio_add_page(bio, page, PAGE_SIZE, 0);
>         bio_inc_remaining(parent);
>         submit_bio(bio);
> +
> +       return 0;
>  }
>
>  static void zram_sync_read(struct work_struct *w)
> @@ -1523,8 +1525,7 @@ static int read_from_bdev(struct zram *zram, struct page *page, u32 index,
>                         return -EIO;
>                 return read_from_bdev_sync(zram, page, index, blk_idx);
>         }
> -       read_from_bdev_async(zram, page, index, blk_idx, parent);
> -       return 0;
> +       return read_from_bdev_async(zram, page, index, blk_idx, parent);
>  }
>  #else
>  static inline void reset_bdev(struct zram *zram) {};
> --
> 2.53.0.851.ga537e3e6e9-goog
>


      reply	other threads:[~2026-03-16  2:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16  1:53 Sergey Senozhatsky
2026-03-16  2:22 ` Brian Geffon [this message]

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=CADyq12xB7zpZq9xTe1sJa2O+dv1e3pbdJjWrTcpagRbGC1MfWQ@mail.gmail.com \
    --to=bgeffon@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=richardycc@google.com \
    --cc=senozhatsky@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox