ceph-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ceph: print more information when we can't find snaprealm during ceph_add_cap
@ 2021-08-02 19:39 Jeff Layton
  2021-08-02 19:44 ` Jeff Layton
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2021-08-02 19:39 UTC (permalink / raw)
  To: ceph-devel; +Cc: idryomov, Sage Weil

Print a bit more information when we can't find the realm during
ceph_add_cap. Show both the inode number and the old realm inode
number.

URL: https://tracker.ceph.com/issues/46419
Suggested-by: Sage Weil <sage@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/ceph/caps.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index cecd4f66a60d..b4c3546def01 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -703,13 +703,12 @@ void ceph_add_cap(struct inode *inode,
 		 */
 		struct ceph_snap_realm *realm = ceph_lookup_snap_realm(mdsc,
 							       realmino);
-		if (realm) {
+		if (realm)
 			ceph_change_snap_realm(inode, realm);
-		} else {
-			pr_err("ceph_add_cap: couldn't find snap realm %llx\n",
-			       realmino);
-			WARN_ON(!realm);
-		}
+		else
+			WARN("ceph_add_cap: couldn't find snap realm 0x%llx (ino 0x%llx oldrealm 0x%llx)\n",
+			     realmino, ci->vino.ino,
+			     ci->i_snap_realm ? ci->i_snap_realm->ino : 0);
 	}
 
 	__check_cap_issue(ci, cap, issued);
-- 
2.31.1


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

* Re: [PATCH] ceph: print more information when we can't find snaprealm during ceph_add_cap
  2021-08-02 19:39 [PATCH] ceph: print more information when we can't find snaprealm during ceph_add_cap Jeff Layton
@ 2021-08-02 19:44 ` Jeff Layton
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2021-08-02 19:44 UTC (permalink / raw)
  To: ceph-devel; +Cc: idryomov, Sage Weil

On Mon, 2021-08-02 at 15:39 -0400, Jeff Layton wrote:
> Print a bit more information when we can't find the realm during
> ceph_add_cap. Show both the inode number and the old realm inode
> number.
> 
> URL: https://tracker.ceph.com/issues/46419
> Suggested-by: Sage Weil <sage@redhat.com>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/ceph/caps.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> index cecd4f66a60d..b4c3546def01 100644
> --- a/fs/ceph/caps.c
> +++ b/fs/ceph/caps.c
> @@ -703,13 +703,12 @@ void ceph_add_cap(struct inode *inode,
>  		 */
>  		struct ceph_snap_realm *realm = ceph_lookup_snap_realm(mdsc,
>  							       realmino);
> -		if (realm) {
> +		if (realm)
>  			ceph_change_snap_realm(inode, realm);
> -		} else {
> -			pr_err("ceph_add_cap: couldn't find snap realm %llx\n",
> -			       realmino);
> -			WARN_ON(!realm);
> -		}
> +		else
> +			WARN("ceph_add_cap: couldn't find snap realm 0x%llx (ino 0x%llx oldrealm 0x%llx)\n",
> +			     realmino, ci->vino.ino,
> +			     ci->i_snap_realm ? ci->i_snap_realm->ino : 0);
>  	}
>  
>  	__check_cap_issue(ci, cap, issued);

Doh! I sent a broken version of this patch.

The first argument to warn is the condition so this should read "WARN(1,
"ceph_add_cap...". The version in testing branch is correct.

Sorry for the noise!
-- 
Jeff Layton <jlayton@kernel.org>


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

end of thread, other threads:[~2021-08-02 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 19:39 [PATCH] ceph: print more information when we can't find snaprealm during ceph_add_cap Jeff Layton
2021-08-02 19:44 ` Jeff Layton

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).