stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Luís Henriques" <lhenriques@suse.de>
To: Xiubo Li <xiubli@redhat.com>
Cc: jlayton@kernel.org, idryomov@gmail.com, vshankar@redhat.com,
	ceph-devel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] ceph: check folio PG_private bit instead of folio->private
Date: Mon, 9 May 2022 10:13:11 +0100	[thread overview]
Message-ID: <YnjbJ/2DbPkTAKnI@suse.de> (raw)
In-Reply-To: <20220508061543.318394-1-xiubli@redhat.com>

On Sun, May 08, 2022 at 02:15:43PM +0800, Xiubo Li wrote:
> The pages in the file mapping maybe reclaimed and reused by other
> subsystems and the page->private maybe used as flags field or
> something else, if later that pages are used by page caches again
> the page->private maybe not cleared as expected.
> 
> Here will check the PG_private bit instead of the folio->private.

I thought that a patch to set ->private to NULL in the folio code (maybe
in folio_end_private_2()) would make sense.  But then... it probably
wouldn't get accepted as we're probably not supposed to assume these
fields are initialised.

Anyway, thanks Xiubo!

Reviewed-by: Luís Henriques <lhenriques@suse.de>

Cheers,
--
Luís

> 
> Cc: stable@vger.kernel.org
> URL: https://tracker.ceph.com/issues/55421
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/addr.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 63b7430e1ce6..1a108f24e7d9 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -85,7 +85,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
>  	if (folio_test_dirty(folio)) {
>  		dout("%p dirty_folio %p idx %lu -- already dirty\n",
>  		     mapping->host, folio, folio->index);
> -		VM_BUG_ON_FOLIO(!folio_get_private(folio), folio);
> +		VM_BUG_ON_FOLIO(!folio_test_private(folio), folio);
>  		return false;
>  	}
>  
> @@ -122,7 +122,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)
>  	 * Reference snap context in folio->private.  Also set
>  	 * PagePrivate so that we get invalidate_folio callback.
>  	 */
> -	VM_BUG_ON_FOLIO(folio_get_private(folio), folio);
> +	VM_BUG_ON_FOLIO(folio_test_private(folio), folio);
>  	folio_attach_private(folio, snapc);
>  
>  	return ceph_fscache_dirty_folio(mapping, folio);
> @@ -150,7 +150,7 @@ static void ceph_invalidate_folio(struct folio *folio, size_t offset,
>  	}
>  
>  	WARN_ON(!folio_test_locked(folio));
> -	if (folio_get_private(folio)) {
> +	if (folio_test_private(folio)) {
>  		dout("%p invalidate_folio idx %lu full dirty page\n",
>  		     inode, folio->index);
>  
> -- 
> 2.36.0.rc1
> 

  parent reply	other threads:[~2022-05-09  9:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-08  6:15 [PATCH] ceph: check folio PG_private bit instead of folio->private Xiubo Li
2022-05-08 11:00 ` Jeff Layton
2022-05-09  9:13 ` Luís Henriques [this message]
2022-05-09 10:06   ` Xiubo Li

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=YnjbJ/2DbPkTAKnI@suse.de \
    --to=lhenriques@suse.de \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vshankar@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).