All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref
@ 2021-07-17 10:06 Xiyu Yang
  2021-07-17 11:21 ` Jeff Layton
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Xiyu Yang @ 2021-07-17 10:06 UTC (permalink / raw)
  To: Jeff Layton, Ilya Dryomov, ceph-devel, linux-kernel
  Cc: yuanxzhang, Xiyu Yang, Xin Tan

refcount_t type and corresponding API can protect refcounters from
accidental underflow and overflow and further use-after-free situations.

Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
---
 fs/ceph/snap.c  | 15 ++++++++-------
 fs/ceph/super.h |  3 ++-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 4ac0606dcbd4..d4ec9c5118bd 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -68,14 +68,15 @@ void ceph_get_snap_realm(struct ceph_mds_client *mdsc,
 	lockdep_assert_held(&mdsc->snap_rwsem);
 
 	dout("get_realm %p %d -> %d\n", realm,
-	     atomic_read(&realm->nref), atomic_read(&realm->nref)+1);
+	     refcount_read(&realm->nref), refcount_read(&realm->nref)+1);
 	/*
 	 * since we _only_ increment realm refs or empty the empty
 	 * list with snap_rwsem held, adjusting the empty list here is
 	 * safe.  we do need to protect against concurrent empty list
 	 * additions, however.
 	 */
-	if (atomic_inc_return(&realm->nref) == 1) {
+	refcount_inc(&realm->nref);
+	if (refcount_read(&realm->nref) == 1) {
 		spin_lock(&mdsc->snap_empty_lock);
 		list_del_init(&realm->empty_item);
 		spin_unlock(&mdsc->snap_empty_lock);
@@ -121,7 +122,7 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
 	if (!realm)
 		return ERR_PTR(-ENOMEM);
 
-	atomic_set(&realm->nref, 1);    /* for caller */
+	refcount_set(&realm->nref, 1);    /* for caller */
 	realm->ino = ino;
 	INIT_LIST_HEAD(&realm->children);
 	INIT_LIST_HEAD(&realm->child_item);
@@ -209,8 +210,8 @@ static void __put_snap_realm(struct ceph_mds_client *mdsc,
 	lockdep_assert_held_write(&mdsc->snap_rwsem);
 
 	dout("__put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
-	     atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
-	if (atomic_dec_and_test(&realm->nref))
+	     refcount_read(&realm->nref), refcount_read(&realm->nref)-1);
+	if (refcount_dec_and_test(&realm->nref))
 		__destroy_snap_realm(mdsc, realm);
 }
 
@@ -221,8 +222,8 @@ void ceph_put_snap_realm(struct ceph_mds_client *mdsc,
 			 struct ceph_snap_realm *realm)
 {
 	dout("put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
-	     atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
-	if (!atomic_dec_and_test(&realm->nref))
+	     refcount_read(&realm->nref), refcount_read(&realm->nref)-1);
+	if (!refcount_dec_and_test(&realm->nref))
 		return;
 
 	if (down_write_trylock(&mdsc->snap_rwsem)) {
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 6b6332a5c113..3abb00d7a0eb 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -2,6 +2,7 @@
 #ifndef _FS_CEPH_SUPER_H
 #define _FS_CEPH_SUPER_H
 
+#include <linux/refcount.h>
 #include <linux/ceph/ceph_debug.h>
 
 #include <asm/unaligned.h>
@@ -859,7 +860,7 @@ struct ceph_readdir_cache_control {
 struct ceph_snap_realm {
 	u64 ino;
 	struct inode *inode;
-	atomic_t nref;
+	refcount_t nref;
 	struct rb_node node;
 
 	u64 created, seq;
-- 
2.7.4


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

* Re: [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref
  2021-07-17 10:06 [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref Xiyu Yang
@ 2021-07-17 11:21 ` Jeff Layton
  2021-07-17 12:26   ` Xiyu Yang
  2021-07-18 19:58   ` kernel test robot
  2021-07-18 20:02   ` kernel test robot
  2 siblings, 1 reply; 9+ messages in thread
From: Jeff Layton @ 2021-07-17 11:21 UTC (permalink / raw)
  To: Xiyu Yang, Ilya Dryomov, ceph-devel, linux-kernel
  Cc: yuanxzhang, Xin Tan, Yejune Deng

On Sat, 2021-07-17 at 18:06 +0800, Xiyu Yang wrote:
> refcount_t type and corresponding API can protect refcounters from
> accidental underflow and overflow and further use-after-free situations.
> 
> Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
> Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
> ---
>  fs/ceph/snap.c  | 15 ++++++++-------
>  fs/ceph/super.h |  3 ++-
>  2 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
> index 4ac0606dcbd4..d4ec9c5118bd 100644
> --- a/fs/ceph/snap.c
> +++ b/fs/ceph/snap.c
> @@ -68,14 +68,15 @@ void ceph_get_snap_realm(struct ceph_mds_client *mdsc,
>  	lockdep_assert_held(&mdsc->snap_rwsem);
>  
>  	dout("get_realm %p %d -> %d\n", realm,
> -	     atomic_read(&realm->nref), atomic_read(&realm->nref)+1);
> +	     refcount_read(&realm->nref), refcount_read(&realm->nref)+1);
>  	/*
>  	 * since we _only_ increment realm refs or empty the empty
>  	 * list with snap_rwsem held, adjusting the empty list here is
>  	 * safe.  we do need to protect against concurrent empty list
>  	 * additions, however.
>  	 */
> -	if (atomic_inc_return(&realm->nref) == 1) {
> +	refcount_inc(&realm->nref);
> +	if (refcount_read(&realm->nref) == 1) {

The above is potentially racy as you've turned a single atomic operation
into two. Another task could come in and increment or decrement
realm->nref just after your recount_inc but before the refcount_read,
and then the read would show the wrong result.

FWIW, Yejune Deng (cc'ed) proposed a very similar patch a few months ago
that caused this regression:

    https://tracker.ceph.com/issues/50281

>  		spin_lock(&mdsc->snap_empty_lock);
>  		list_del_init(&realm->empty_item);
>  		spin_unlock(&mdsc->snap_empty_lock);
> @@ -121,7 +122,7 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
>  	if (!realm)
>  		return ERR_PTR(-ENOMEM);
>  
> -	atomic_set(&realm->nref, 1);    /* for caller */
> +	refcount_set(&realm->nref, 1);    /* for caller */
>  	realm->ino = ino;
>  	INIT_LIST_HEAD(&realm->children);
>  	INIT_LIST_HEAD(&realm->child_item);
> @@ -209,8 +210,8 @@ static void __put_snap_realm(struct ceph_mds_client *mdsc,
>  	lockdep_assert_held_write(&mdsc->snap_rwsem);
>  
>  	dout("__put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
> -	     atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
> -	if (atomic_dec_and_test(&realm->nref))
> +	     refcount_read(&realm->nref), refcount_read(&realm->nref)-1);
> +	if (refcount_dec_and_test(&realm->nref))
>  		__destroy_snap_realm(mdsc, realm);
>  }
>  
> @@ -221,8 +222,8 @@ void ceph_put_snap_realm(struct ceph_mds_client *mdsc,
>  			 struct ceph_snap_realm *realm)
>  {
>  	dout("put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
> -	     atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
> -	if (!atomic_dec_and_test(&realm->nref))
> +	     refcount_read(&realm->nref), refcount_read(&realm->nref)-1);
> +	if (!refcount_dec_and_test(&realm->nref))
>  		return;
>  
>  	if (down_write_trylock(&mdsc->snap_rwsem)) {
> diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> index 6b6332a5c113..3abb00d7a0eb 100644
> --- a/fs/ceph/super.h
> +++ b/fs/ceph/super.h
> @@ -2,6 +2,7 @@
>  #ifndef _FS_CEPH_SUPER_H
>  #define _FS_CEPH_SUPER_H
>  
> +#include <linux/refcount.h>
>  #include <linux/ceph/ceph_debug.h>
>  
>  #include <asm/unaligned.h>
> @@ -859,7 +860,7 @@ struct ceph_readdir_cache_control {
>  struct ceph_snap_realm {
>  	u64 ino;
>  	struct inode *inode;
> -	atomic_t nref;
> +	refcount_t nref;
>  	struct rb_node node;
>  
>  	u64 created, seq;

-- 
Jeff Layton <jlayton@kernel.org>


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

* Re: Re: [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref
  2021-07-17 11:21 ` Jeff Layton
@ 2021-07-17 12:26   ` Xiyu Yang
  2021-07-17 13:40     ` Jeff Layton
  0 siblings, 1 reply; 9+ messages in thread
From: Xiyu Yang @ 2021-07-17 12:26 UTC (permalink / raw)
  To: Jeff Layton
  Cc: Ilya Dryomov, ceph-devel, linux-kernel, yuanxzhang, Xin Tan, Yejune Deng

Thank you for pointing out the problem in the patch. I cannot find an unique refcount API work like atomic_inc_return, thus I chose two APIs to play a similar role and forgot the potential racy case. So are you have a better choice to help this refcount type convertation?


> -----Original Messages-----
> From: "Jeff Layton" <jlayton@kernel.org>
> Sent Time: 2021-07-17 19:21:40 (Saturday)
> To: "Xiyu Yang" <xiyuyang19@fudan.edu.cn>, "Ilya Dryomov" <idryomov@gmail.com>, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
> Cc: yuanxzhang@fudan.edu.cn, "Xin Tan" <tanxin.ctf@gmail.com>, "Yejune Deng" <yejune.deng@gmail.com>
> Subject: Re: [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref
> 
> On Sat, 2021-07-17 at 18:06 +0800, Xiyu Yang wrote:
> > refcount_t type and corresponding API can protect refcounters from
> > accidental underflow and overflow and further use-after-free situations.
> > 
> > Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
> > Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
> > ---
> >  fs/ceph/snap.c  | 15 ++++++++-------
> >  fs/ceph/super.h |  3 ++-
> >  2 files changed, 10 insertions(+), 8 deletions(-)
> > 
> > diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
> > index 4ac0606dcbd4..d4ec9c5118bd 100644
> > --- a/fs/ceph/snap.c
> > +++ b/fs/ceph/snap.c
> > @@ -68,14 +68,15 @@ void ceph_get_snap_realm(struct ceph_mds_client *mdsc,
> >  	lockdep_assert_held(&mdsc->snap_rwsem);
> >  
> >  	dout("get_realm %p %d -> %d\n", realm,
> > -	     atomic_read(&realm->nref), atomic_read(&realm->nref)+1);
> > +	     refcount_read(&realm->nref), refcount_read(&realm->nref)+1);
> >  	/*
> >  	 * since we _only_ increment realm refs or empty the empty
> >  	 * list with snap_rwsem held, adjusting the empty list here is
> >  	 * safe.  we do need to protect against concurrent empty list
> >  	 * additions, however.
> >  	 */
> > -	if (atomic_inc_return(&realm->nref) == 1) {
> > +	refcount_inc(&realm->nref);
> > +	if (refcount_read(&realm->nref) == 1) {
> 
> The above is potentially racy as you've turned a single atomic operation
> into two. Another task could come in and increment or decrement
> realm->nref just after your recount_inc but before the refcount_read,
> and then the read would show the wrong result.
> 
> FWIW, Yejune Deng (cc'ed) proposed a very similar patch a few months ago
> that caused this regression:
> 
>     https://tracker.ceph.com/issues/50281
> 
> >  		spin_lock(&mdsc->snap_empty_lock);
> >  		list_del_init(&realm->empty_item);
> >  		spin_unlock(&mdsc->snap_empty_lock);
> > @@ -121,7 +122,7 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
> >  	if (!realm)
> >  		return ERR_PTR(-ENOMEM);
> >  
> > -	atomic_set(&realm->nref, 1);    /* for caller */
> > +	refcount_set(&realm->nref, 1);    /* for caller */
> >  	realm->ino = ino;
> >  	INIT_LIST_HEAD(&realm->children);
> >  	INIT_LIST_HEAD(&realm->child_item);
> > @@ -209,8 +210,8 @@ static void __put_snap_realm(struct ceph_mds_client *mdsc,
> >  	lockdep_assert_held_write(&mdsc->snap_rwsem);
> >  
> >  	dout("__put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
> > -	     atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
> > -	if (atomic_dec_and_test(&realm->nref))
> > +	     refcount_read(&realm->nref), refcount_read(&realm->nref)-1);
> > +	if (refcount_dec_and_test(&realm->nref))
> >  		__destroy_snap_realm(mdsc, realm);
> >  }
> >  
> > @@ -221,8 +222,8 @@ void ceph_put_snap_realm(struct ceph_mds_client *mdsc,
> >  			 struct ceph_snap_realm *realm)
> >  {
> >  	dout("put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
> > -	     atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
> > -	if (!atomic_dec_and_test(&realm->nref))
> > +	     refcount_read(&realm->nref), refcount_read(&realm->nref)-1);
> > +	if (!refcount_dec_and_test(&realm->nref))
> >  		return;
> >  
> >  	if (down_write_trylock(&mdsc->snap_rwsem)) {
> > diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> > index 6b6332a5c113..3abb00d7a0eb 100644
> > --- a/fs/ceph/super.h
> > +++ b/fs/ceph/super.h
> > @@ -2,6 +2,7 @@
> >  #ifndef _FS_CEPH_SUPER_H
> >  #define _FS_CEPH_SUPER_H
> >  
> > +#include <linux/refcount.h>
> >  #include <linux/ceph/ceph_debug.h>
> >  
> >  #include <asm/unaligned.h>
> > @@ -859,7 +860,7 @@ struct ceph_readdir_cache_control {
> >  struct ceph_snap_realm {
> >  	u64 ino;
> >  	struct inode *inode;
> > -	atomic_t nref;
> > +	refcount_t nref;
> >  	struct rb_node node;
> >  
> >  	u64 created, seq;
> 
> -- 
> Jeff Layton <jlayton@kernel.org>







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

* Re: Re: [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref
  2021-07-17 12:26   ` Xiyu Yang
@ 2021-07-17 13:40     ` Jeff Layton
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Layton @ 2021-07-17 13:40 UTC (permalink / raw)
  To: Xiyu Yang
  Cc: Ilya Dryomov, ceph-devel, linux-kernel, yuanxzhang, Xin Tan, Yejune Deng

I think this is probably a place where we just can't reasonably convert
to using refcount_t, as the lifecycle of the refcounted objects doesn't
fully conform to the "standard" refcount_t model.

It may also be possible to extend the refcount_t API with a
refcount_inc_return or something, but I'm not sure that really gains us
much here.

-- Jeff

On Sat, 2021-07-17 at 20:26 +0800, Xiyu Yang wrote:
> Thank you for pointing out the problem in the patch. I cannot find an unique refcount API work like atomic_inc_return, thus I chose two APIs to play a similar role and forgot the potential racy case. So are you have a better choice to help this refcount type convertation?
> 
> 
> > -----Original Messages-----
> > From: "Jeff Layton" <jlayton@kernel.org>
> > Sent Time: 2021-07-17 19:21:40 (Saturday)
> > To: "Xiyu Yang" <xiyuyang19@fudan.edu.cn>, "Ilya Dryomov" <idryomov@gmail.com>, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
> > Cc: yuanxzhang@fudan.edu.cn, "Xin Tan" <tanxin.ctf@gmail.com>, "Yejune Deng" <yejune.deng@gmail.com>
> > Subject: Re: [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref
> > 
> > On Sat, 2021-07-17 at 18:06 +0800, Xiyu Yang wrote:
> > > refcount_t type and corresponding API can protect refcounters from
> > > accidental underflow and overflow and further use-after-free situations.
> > > 
> > > Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
> > > Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
> > > ---
> > >  fs/ceph/snap.c  | 15 ++++++++-------
> > >  fs/ceph/super.h |  3 ++-
> > >  2 files changed, 10 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
> > > index 4ac0606dcbd4..d4ec9c5118bd 100644
> > > --- a/fs/ceph/snap.c
> > > +++ b/fs/ceph/snap.c
> > > @@ -68,14 +68,15 @@ void ceph_get_snap_realm(struct ceph_mds_client *mdsc,
> > >  	lockdep_assert_held(&mdsc->snap_rwsem);
> > >  
> > >  	dout("get_realm %p %d -> %d\n", realm,
> > > -	     atomic_read(&realm->nref), atomic_read(&realm->nref)+1);
> > > +	     refcount_read(&realm->nref), refcount_read(&realm->nref)+1);
> > >  	/*
> > >  	 * since we _only_ increment realm refs or empty the empty
> > >  	 * list with snap_rwsem held, adjusting the empty list here is
> > >  	 * safe.  we do need to protect against concurrent empty list
> > >  	 * additions, however.
> > >  	 */
> > > -	if (atomic_inc_return(&realm->nref) == 1) {
> > > +	refcount_inc(&realm->nref);
> > > +	if (refcount_read(&realm->nref) == 1) {
> > 
> > The above is potentially racy as you've turned a single atomic operation
> > into two. Another task could come in and increment or decrement
> > realm->nref just after your recount_inc but before the refcount_read,
> > and then the read would show the wrong result.
> > 
> > FWIW, Yejune Deng (cc'ed) proposed a very similar patch a few months ago
> > that caused this regression:
> > 
> >     https://tracker.ceph.com/issues/50281
> > 
> > >  		spin_lock(&mdsc->snap_empty_lock);
> > >  		list_del_init(&realm->empty_item);
> > >  		spin_unlock(&mdsc->snap_empty_lock);
> > > @@ -121,7 +122,7 @@ static struct ceph_snap_realm *ceph_create_snap_realm(
> > >  	if (!realm)
> > >  		return ERR_PTR(-ENOMEM);
> > >  
> > > -	atomic_set(&realm->nref, 1);    /* for caller */
> > > +	refcount_set(&realm->nref, 1);    /* for caller */
> > >  	realm->ino = ino;
> > >  	INIT_LIST_HEAD(&realm->children);
> > >  	INIT_LIST_HEAD(&realm->child_item);
> > > @@ -209,8 +210,8 @@ static void __put_snap_realm(struct ceph_mds_client *mdsc,
> > >  	lockdep_assert_held_write(&mdsc->snap_rwsem);
> > >  
> > >  	dout("__put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
> > > -	     atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
> > > -	if (atomic_dec_and_test(&realm->nref))
> > > +	     refcount_read(&realm->nref), refcount_read(&realm->nref)-1);
> > > +	if (refcount_dec_and_test(&realm->nref))
> > >  		__destroy_snap_realm(mdsc, realm);
> > >  }
> > >  
> > > @@ -221,8 +222,8 @@ void ceph_put_snap_realm(struct ceph_mds_client *mdsc,
> > >  			 struct ceph_snap_realm *realm)
> > >  {
> > >  	dout("put_snap_realm %llx %p %d -> %d\n", realm->ino, realm,
> > > -	     atomic_read(&realm->nref), atomic_read(&realm->nref)-1);
> > > -	if (!atomic_dec_and_test(&realm->nref))
> > > +	     refcount_read(&realm->nref), refcount_read(&realm->nref)-1);
> > > +	if (!refcount_dec_and_test(&realm->nref))
> > >  		return;
> > >  
> > >  	if (down_write_trylock(&mdsc->snap_rwsem)) {
> > > diff --git a/fs/ceph/super.h b/fs/ceph/super.h
> > > index 6b6332a5c113..3abb00d7a0eb 100644
> > > --- a/fs/ceph/super.h
> > > +++ b/fs/ceph/super.h
> > > @@ -2,6 +2,7 @@
> > >  #ifndef _FS_CEPH_SUPER_H
> > >  #define _FS_CEPH_SUPER_H
> > >  
> > > +#include <linux/refcount.h>
> > >  #include <linux/ceph/ceph_debug.h>
> > >  
> > >  #include <asm/unaligned.h>
> > > @@ -859,7 +860,7 @@ struct ceph_readdir_cache_control {
> > >  struct ceph_snap_realm {
> > >  	u64 ino;
> > >  	struct inode *inode;
> > > -	atomic_t nref;
> > > +	refcount_t nref;
> > >  	struct rb_node node;
> > >  
> > >  	u64 created, seq;
> > 
> > -- 
> > Jeff Layton <jlayton@kernel.org>
> 
> 
> 
> 
> 
> 

-- 
Jeff Layton <jlayton@kernel.org>


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

* Re: [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref
  2021-07-17 10:06 [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref Xiyu Yang
@ 2021-07-18 19:58   ` kernel test robot
  2021-07-18 19:58   ` kernel test robot
  2021-07-18 20:02   ` kernel test robot
  2 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-07-18 19:58 UTC (permalink / raw)
  To: Xiyu Yang, Jeff Layton, Ilya Dryomov, ceph-devel, linux-kernel
  Cc: clang-built-linux, kbuild-all, yuanxzhang, Xiyu Yang, Xin Tan

[-- Attachment #1: Type: text/plain, Size: 2417 bytes --]

Hi Xiyu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on ceph-client/for-linus]
[also build test WARNING on v5.14-rc1 next-20210716]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Xiyu-Yang/ceph-Convert-from-atomic_t-to-refcount_t-on-ceph_snap_realm-nref/20210718-111108
base:   https://github.com/ceph/ceph-client.git for-linus
config: arm-randconfig-r034-20210718 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5d5b08761f944d5b9822d582378333cc4b36a0a7)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/0day-ci/linux/commit/af8e5c68ccb6a1e5aead78e10d6d0441c032ba66
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Xiyu-Yang/ceph-Convert-from-atomic_t-to-refcount_t-on-ceph_snap_realm-nref/20210718-111108
        git checkout af8e5c68ccb6a1e5aead78e10d6d0441c032ba66
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from fs/ceph/quota.c:10:
   In file included from fs/ceph/super.h:6:
>> include/linux/ceph/ceph_debug.h:5:9: warning: 'pr_fmt' macro redefined [-Wmacro-redefined]
   #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
           ^
   include/linux/printk.h:301:9: note: previous definition is here
   #define pr_fmt(fmt) fmt
           ^
   1 warning generated.


vim +/pr_fmt +5 include/linux/ceph/ceph_debug.h

de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06  4  
de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06 @5  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06  6  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41036 bytes --]

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

* Re: [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref
@ 2021-07-18 19:58   ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-07-18 19:58 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2470 bytes --]

Hi Xiyu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on ceph-client/for-linus]
[also build test WARNING on v5.14-rc1 next-20210716]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Xiyu-Yang/ceph-Convert-from-atomic_t-to-refcount_t-on-ceph_snap_realm-nref/20210718-111108
base:   https://github.com/ceph/ceph-client.git for-linus
config: arm-randconfig-r034-20210718 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 5d5b08761f944d5b9822d582378333cc4b36a0a7)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/0day-ci/linux/commit/af8e5c68ccb6a1e5aead78e10d6d0441c032ba66
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Xiyu-Yang/ceph-Convert-from-atomic_t-to-refcount_t-on-ceph_snap_realm-nref/20210718-111108
        git checkout af8e5c68ccb6a1e5aead78e10d6d0441c032ba66
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from fs/ceph/quota.c:10:
   In file included from fs/ceph/super.h:6:
>> include/linux/ceph/ceph_debug.h:5:9: warning: 'pr_fmt' macro redefined [-Wmacro-redefined]
   #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
           ^
   include/linux/printk.h:301:9: note: previous definition is here
   #define pr_fmt(fmt) fmt
           ^
   1 warning generated.


vim +/pr_fmt +5 include/linux/ceph/ceph_debug.h

de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06  4  
de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06 @5  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06  6  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41036 bytes --]

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

* Re: [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref
  2021-07-17 10:06 [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref Xiyu Yang
@ 2021-07-18 20:02   ` kernel test robot
  2021-07-18 19:58   ` kernel test robot
  2021-07-18 20:02   ` kernel test robot
  2 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-07-18 20:02 UTC (permalink / raw)
  To: Xiyu Yang, Jeff Layton, Ilya Dryomov, ceph-devel, linux-kernel
  Cc: kbuild-all, yuanxzhang, Xiyu Yang, Xin Tan

[-- Attachment #1: Type: text/plain, Size: 2630 bytes --]

Hi Xiyu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on ceph-client/for-linus]
[also build test WARNING on v5.14-rc1 next-20210716]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Xiyu-Yang/ceph-Convert-from-atomic_t-to-refcount_t-on-ceph_snap_realm-nref/20210718-111108
base:   https://github.com/ceph/ceph-client.git for-linus
config: arc-randconfig-r016-20210718 (attached as .config)
compiler: arceb-elf-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/af8e5c68ccb6a1e5aead78e10d6d0441c032ba66
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Xiyu-Yang/ceph-Convert-from-atomic_t-to-refcount_t-on-ceph_snap_realm-nref/20210718-111108
        git checkout af8e5c68ccb6a1e5aead78e10d6d0441c032ba66
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash fs/ceph/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from fs/ceph/super.h:6,
                    from fs/ceph/quota.c:10:
>> include/linux/ceph/ceph_debug.h:5: warning: "pr_fmt" redefined
       5 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
         | 
   In file included from include/linux/kernel.h:17,
                    from include/asm-generic/bug.h:20,
                    from arch/arc/include/asm/bug.h:30,
                    from include/linux/bug.h:5,
                    from include/linux/refcount.h:96,
                    from fs/ceph/super.h:5,
                    from fs/ceph/quota.c:10:
   include/linux/printk.h:301: note: this is the location of the previous definition
     301 | #define pr_fmt(fmt) fmt
         | 


vim +/pr_fmt +5 include/linux/ceph/ceph_debug.h

de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06  4  
de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06 @5  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06  6  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29447 bytes --]

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

* Re: [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref
@ 2021-07-18 20:02   ` kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-07-18 20:02 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2688 bytes --]

Hi Xiyu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on ceph-client/for-linus]
[also build test WARNING on v5.14-rc1 next-20210716]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Xiyu-Yang/ceph-Convert-from-atomic_t-to-refcount_t-on-ceph_snap_realm-nref/20210718-111108
base:   https://github.com/ceph/ceph-client.git for-linus
config: arc-randconfig-r016-20210718 (attached as .config)
compiler: arceb-elf-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/af8e5c68ccb6a1e5aead78e10d6d0441c032ba66
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Xiyu-Yang/ceph-Convert-from-atomic_t-to-refcount_t-on-ceph_snap_realm-nref/20210718-111108
        git checkout af8e5c68ccb6a1e5aead78e10d6d0441c032ba66
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash fs/ceph/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from fs/ceph/super.h:6,
                    from fs/ceph/quota.c:10:
>> include/linux/ceph/ceph_debug.h:5: warning: "pr_fmt" redefined
       5 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
         | 
   In file included from include/linux/kernel.h:17,
                    from include/asm-generic/bug.h:20,
                    from arch/arc/include/asm/bug.h:30,
                    from include/linux/bug.h:5,
                    from include/linux/refcount.h:96,
                    from fs/ceph/super.h:5,
                    from fs/ceph/quota.c:10:
   include/linux/printk.h:301: note: this is the location of the previous definition
     301 | #define pr_fmt(fmt) fmt
         | 


vim +/pr_fmt +5 include/linux/ceph/ceph_debug.h

de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06  4  
de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06 @5  #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
de57606c23afde fs/ceph/ceph_debug.h Sage Weil 2009-10-06  6  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29447 bytes --]

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

* Re: [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref
@ 2021-07-19  3:18 kernel test robot
  0 siblings, 0 replies; 9+ messages in thread
From: kernel test robot @ 2021-07-19  3:18 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 3997 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <1626516381-40440-1-git-send-email-xiyuyang19@fudan.edu.cn>
References: <1626516381-40440-1-git-send-email-xiyuyang19@fudan.edu.cn>
TO: Xiyu Yang <xiyuyang19@fudan.edu.cn>
TO: Jeff Layton <jlayton@kernel.org>
TO: Ilya Dryomov <idryomov@gmail.com>
TO: ceph-devel(a)vger.kernel.org
TO: linux-kernel(a)vger.kernel.org
CC: yuanxzhang(a)fudan.edu.cn
CC: Xiyu Yang <xiyuyang19@fudan.edu.cn>
CC: Xin Tan <tanxin.ctf@gmail.com>

Hi Xiyu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on ceph-client/for-linus]
[also build test WARNING on v5.14-rc2 next-20210716]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Xiyu-Yang/ceph-Convert-from-atomic_t-to-refcount_t-on-ceph_snap_realm-nref/20210718-111108
base:   https://github.com/ceph/ceph-client.git for-linus
:::::: branch date: 24 hours ago
:::::: commit date: 24 hours ago
config: x86_64-rhel-8.3-kselftests (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/af8e5c68ccb6a1e5aead78e10d6d0441c032ba66
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Xiyu-Yang/ceph-Convert-from-atomic_t-to-refcount_t-on-ceph_snap_realm-nref/20210718-111108
        git checkout af8e5c68ccb6a1e5aead78e10d6d0441c032ba66
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/ceph/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
   fs/ceph/quota.c: note: in included file (through fs/ceph/super.h):
   include/linux/ceph/ceph_debug.h:5:9: sparse: sparse: preprocessor token pr_fmt redefined
   fs/ceph/quota.c: note: in included file (through include/linux/kernel.h, include/asm-generic/bug.h, arch/x86/include/asm/bug.h, ...):
>> include/linux/printk.h:301:9: sparse: this was the original definition

vim +301 include/linux/printk.h

01c313dded34a1 Arnd Bergmann   2017-11-13  286  
90c165f0de3ada Ricardo Cañuelo 2020-04-03  287  /**
90c165f0de3ada Ricardo Cañuelo 2020-04-03  288   * pr_fmt - used by the pr_*() macros to generate the printk format string
90c165f0de3ada Ricardo Cañuelo 2020-04-03  289   * @fmt: format string passed from a pr_*() macro
90c165f0de3ada Ricardo Cañuelo 2020-04-03  290   *
90c165f0de3ada Ricardo Cañuelo 2020-04-03  291   * This macro can be used to generate a unified format string for pr_*()
90c165f0de3ada Ricardo Cañuelo 2020-04-03  292   * macros. A common use is to prefix all pr_*() messages in a file with a common
90c165f0de3ada Ricardo Cañuelo 2020-04-03  293   * string. For example, defining this at the top of a source file:
90c165f0de3ada Ricardo Cañuelo 2020-04-03  294   *
90c165f0de3ada Ricardo Cañuelo 2020-04-03  295   *        #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
90c165f0de3ada Ricardo Cañuelo 2020-04-03  296   *
90c165f0de3ada Ricardo Cañuelo 2020-04-03  297   * would prefix all pr_info, pr_emerg... messages in the file with the module
90c165f0de3ada Ricardo Cañuelo 2020-04-03  298   * name.
90c165f0de3ada Ricardo Cañuelo 2020-04-03  299   */
968ab1838a5d48 Linus Torvalds  2010-11-15  300  #ifndef pr_fmt
968ab1838a5d48 Linus Torvalds  2010-11-15 @301  #define pr_fmt(fmt) fmt
968ab1838a5d48 Linus Torvalds  2010-11-15  302  #endif
968ab1838a5d48 Linus Torvalds  2010-11-15  303  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41837 bytes --]

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

end of thread, other threads:[~2021-07-19  3:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-17 10:06 [PATCH] ceph: Convert from atomic_t to refcount_t on ceph_snap_realm->nref Xiyu Yang
2021-07-17 11:21 ` Jeff Layton
2021-07-17 12:26   ` Xiyu Yang
2021-07-17 13:40     ` Jeff Layton
2021-07-18 19:58 ` kernel test robot
2021-07-18 19:58   ` kernel test robot
2021-07-18 20:02 ` kernel test robot
2021-07-18 20:02   ` kernel test robot
2021-07-19  3:18 kernel test robot

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.