mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
To: Xiubo Li <xiubli@redhat.com>,
	"dan.carpenter@linaro.org" <dan.carpenter@linaro.org>
Cc: "kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>,
	"idryomov@gmail.com" <idryomov@gmail.com>,
	"willy@infradead.org" <willy@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re:  [PATCH] ceph: fix NULL vs IS_ERR() bug in ceph_zero_partial_page()
Date: Fri, 27 Jun 2025 19:52:19 +0000	[thread overview]
Message-ID: <5a7ba595350d1aabf7e5ba4deeac4d2707a101ff.camel@ibm.com> (raw)
In-Reply-To: <685c1424.050a0220.baa8.d6a1@mx.google.com>

On Wed, 2025-06-25 at 10:22 -0500, Dan Carpenter wrote:
> The filemap_lock_folio() never returns NULL.  It returns error pointers.
> Update the checking to match.
> 
> Fixes: 483239f03149 ("ceph: convert ceph_zero_partial_page() to use a folio")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  fs/ceph/file.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> index d5c674d2ba8a..f6e63265c516 100644
> --- a/fs/ceph/file.c
> +++ b/fs/ceph/file.c
> @@ -2536,12 +2536,13 @@ static inline void ceph_zero_partial_page(struct inode *inode,
>  	struct folio *folio;
>  
>  	folio = filemap_lock_folio(inode->i_mapping, offset >> PAGE_SHIFT);
> -	if (folio) {
> -		folio_wait_writeback(folio);
> -		folio_zero_range(folio, offset_in_folio(folio, offset), size);
> -		folio_unlock(folio);
> -		folio_put(folio);
> -	}
> +	if (IS_ERR(folio))
> +		return;
> +
> +	folio_wait_writeback(folio);
> +	folio_zero_range(folio, offset_in_folio(folio, offset), size);
> +	folio_unlock(folio);
> +	folio_put(folio);
>  }
>  
>  static void ceph_zero_pagecache_range(struct inode *inode, loff_t offset,

Looks good!

Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>

Thanks,
Slava.

      reply	other threads:[~2025-06-27 19:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-25 15:22 Dan Carpenter
2025-06-27 19:52 ` Viacheslav Dubeyko [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=5a7ba595350d1aabf7e5ba4deeac4d2707a101ff.camel@ibm.com \
    --to=slava.dubeyko@ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=idryomov@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@infradead.org \
    --cc=xiubli@redhat.com \
    /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

all inboxes | Powered by JetHome®