Skip to contentSkip to conversation

ceph: print more information when we can't find snaprealm during ceph_add_cap

PATCH In review Jeff Layton 1 participant 2 messages Aug 2, 2021 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: print more information when we can't find snaprealm during ceph_add_cap

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

---
 fs/ceph/caps.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
fs/ceph/caps.c +5 -6
index cecd4f66a60d..b4c3546def01 100644
@@ -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);
Signature · 1 line
2.31.1
#1 lore raw
Quoted 24 lines · Jeff Layton

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

---
 fs/ceph/caps.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
fs/ceph/caps.c +1 -3
index cecd4f66a60d..b4c3546def01 100644
@@ -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",

fs/ceph/caps.c void ceph_add_cap(struct inode *inode, · line 714

Quoted 10 lines
fs/ceph/caps.c +4 -3
-			       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!

Signature · 1 line
Jeff Layton <[email protected]>