From patchwork Wed Jan 15 20:53:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viacheslav Dubeyko X-Patchwork-Id: 13940926 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DD481D8DEE; Wed, 15 Jan 2025 20:53:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.5 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736974427; cv=fail; b=MhGlmsOJ+fCWtkDoekjTMFwpmJhYxvF6JOFpBc7MCkxdvBBNTeK0VDRpbZ46S2CsFyvc9HZnWyXZ84w2blqmd3g213smoBk5Kp3PT6m7vpGjYzVWVUwLy9ZKBnGp0gJvbaBBFRHKzI1cWt35KECSu7Cx8L/qLgmN1C4dgy3aPnA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736974427; c=relaxed/simple; bh=iWd9uL9c47tnWunhiMpkTkjfzXvyu1Ib6mpLxXqmQak=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=V3tb4qePD529jyBhLqiuSL4YTqJxnCBRdpAg+WiJtkriluGgUqE34xSsMG1D6YUzkCJzcLCYoAOzQXFDRPTY0Y982/S431jSVpEyfoWry+1Sd9yhsclVkbgrJPd4fPGeIXcngXmdGBOP5xT4UrpiTH+H197C+rZpHXuYo9BUYVE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ibm.com; spf=pass smtp.mailfrom=ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=sPzV69oG; arc=fail smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="sPzV69oG" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50FHX4aD019754; Wed, 15 Jan 2025 20:53:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-id:content-transfer-encoding:content-type:date:from :message-id:mime-version:subject:to; s=pp1; bh=iWd9uL9c47tnWunhi MpkTkjfzXvyu1Ib6mpLxXqmQak=; b=sPzV69oGsvDAO5KKNqzK/t9u9ziiUbUox FLO3H9l/PBcenETY4x5XoXGSsEztWpyK/EKGrry/Mi2m164GtiHsf3yRxLX7zWjC ZIpxDY0vXrTcc1bK1m1kxLiYG7cuKN30CMcdg47GDGPO7HSSa1lVupkzPYwShy6E M18Xxa8gDum4tTMaqTuqw4P4an+m7L0Gt2WO/HdINgw/7TWoJxE99ah4/rXEJMrF 5NiQWpDg+qPVSI/H30qgZDTDQhcgmCeqJB9Ss4I5wTR9F9kUCct7E9V0ZB+31/UI CWPJ90PJWuwDLu3K5foKaoZqnlAd8x4zikm2eKfeZ2f8b2V0JNqJw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 446eg5t1af-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Jan 2025 20:53:40 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 50FKqDt9019362; Wed, 15 Jan 2025 20:53:39 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2171.outbound.protection.outlook.com [104.47.59.171]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 446eg5t1ad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Jan 2025 20:53:39 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UxVi1OLFAbQF0Th0mSCA239Mb+4klXug1Bg4M1VVbEHHcip+Rf5nhC8no2WtIbNMW1I0nY5ouPCTUeJPJvsk5kKOr65nHa7zpUJwShw6iqOChSkxVvZX+/l6OgUZC5MNkyvsoj7KDZGQN0fp90FaXfyacRGQmu/l3DMjbp4cZmZ3MdIsimkkQGvwiLpeXXgayvmFhFm2a5Qc7IQfqOC2YQzcvxEAuq7WTuW/p3WS9cTM4QiObUjyvbbXJZgljRmnQeohIEas/3+Zw9GjwSUQbvEtHhtABYtuzWKPVt6rDe/onyL1K36FdlL1umdYywRY/Ipmsu56xGi2qT7GE3FBKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iWd9uL9c47tnWunhiMpkTkjfzXvyu1Ib6mpLxXqmQak=; b=EX1qy3baHOltArGr2j8j3+VIWLWIbv5hG0zlOr58KysYumoFM0AjqJmEjMZcpEyqwEv4VPpP7TwGFsQ+uOuRLhxCqu6EnSX1rLVv9HX+hmTMss8Jfgm/90sSt7QTrD+aLBHAvPV0d71SsB0MvV+u0gdmvW6yF8vlwJjNIUm4KsRKTsj98svPSSFHGLAR4jj2EfocT8zvHY5PZsgTbVs5+O7YFuHjBMRCXqWBSw0gbSfIoYFTU9Xhc0SPTxqTedM6y6Pat+13E+TYlZwrG6M5qTW3agZVoFGcDMPqtd+VFH1gFsPk4KCL6MvjPoI3obBKmtJn6TkuEovq65I4uJ//oQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ibm.com; dmarc=pass action=none header.from=ibm.com; dkim=pass header.d=ibm.com; arc=none Received: from SA1PR15MB5819.namprd15.prod.outlook.com (2603:10b6:806:338::8) by IA1PR15MB5468.namprd15.prod.outlook.com (2603:10b6:208:3a8::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.14; Wed, 15 Jan 2025 20:53:36 +0000 Received: from SA1PR15MB5819.namprd15.prod.outlook.com ([fe80::6fd6:67be:7178:d89b]) by SA1PR15MB5819.namprd15.prod.outlook.com ([fe80::6fd6:67be:7178:d89b%7]) with mapi id 15.20.8335.017; Wed, 15 Jan 2025 20:53:36 +0000 From: Viacheslav Dubeyko To: "ceph-devel@vger.kernel.org" CC: Alex Markuze , "linux-fsdevel@vger.kernel.org" , "slava@dubeyko.com" , "idryomov@gmail.com" Subject: [RFC PATCH] ceph: switch libceph on ratelimited messages Thread-Topic: [RFC PATCH] ceph: switch libceph on ratelimited messages Thread-Index: AQHbZ4+Lh4ByCy9ZIUKHf70rtFzBbw== Date: Wed, 15 Jan 2025 20:53:36 +0000 Message-ID: <06b84c0f4c7c86881d5985f391f6d0daa9ee28dd.camel@ibm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SA1PR15MB5819:EE_|IA1PR15MB5468:EE_ x-ms-office365-filtering-correlation-id: 52325601-803a-4ffb-9cc4-08dd35a6ae61 x-ld-processed: fcf67057-50c9-4ad4-98f3-ffca64add9e9,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|10070799003|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?6wsUo+8pq9M4/rAg+VE8DIli8tHwPI9?= =?utf-8?q?nLlxrcatEbagrDsz03jZvtvCHKqVdI1tURRmEJINVdJEHT9bnHchowR2+DLg7apV9?= =?utf-8?q?XIN6ustvaJjE6PhT0lvbyIr7/YkJaDpvPGTCsa5Lws4NbgZOeICLk/dTFCB6bwf6X?= =?utf-8?q?tKQNHjNktNRUGJKVErfc56G6JQ/VOnHTaSh1U71NzLK6vocF4kj9s0r/HhXTcTx5L?= =?utf-8?q?OAo/hxOR2PMr6YMr6Y+xX+n4JbgkSYaZO+hCr1iypoGbtyur084KcF96KcaaSerX3?= =?utf-8?q?nNwhTVv6925zADHYvNSGVmUKGu0P2751CZRkzb+hhhZrJogWHGy1+H2Eh27UtiSGt?= =?utf-8?q?gA2/fX4g5pSTtJCJjdtZKtoXT/Uq7YH37giE6njsQVLBDUHP9eKRzs6S80gsS2sUL?= =?utf-8?q?OmwNA5RNogCb8qrEnXsHcvR5TZ11ACN3+MlSEZ3S7XBPQwLHRocpXS6Qratf8QB5B?= =?utf-8?q?1+wMDWo/UDNcjjIMD/uUbqbXP8PqlLwkIhwVwDc/+X21fN5yUJlUIVO56slzVmDgA?= =?utf-8?q?qXr3RMwniFnvscrMrHeYb+qieK8OYJcsjaTF7/H5Um6ixUvQVfqMz5Oo9Jf2FBkiF?= =?utf-8?q?1WHS1OPEl+YfmGJJSegybnKZm1gXRNX5IjypWlI7SmBrc/V3RucGrHAB8Hp9A23hl?= =?utf-8?q?zd0msPCX8f7XgudV5/mjvoYtjMIbtULUCjDtH4I1OJXN51x/tfHdyTy03ttJNMomA?= =?utf-8?q?lZPSuz/wfiKc0CwgMPooVnjAkuaS+qc9GazZDWekoLi8p375fOTeAiotKWqbYYyLk?= =?utf-8?q?8VnWnxlznqT0/jhfDQsO7vZBzaCgxYj8XsV5HN1b9pNExhvfclSS21Hs1UsB2ijvz?= =?utf-8?q?Aa1G/gAPYTthrtJ8mNmioJ5esA2R+6C26HkPF/8DoWrA38vzr2sONh6K66Ur3jwWY?= =?utf-8?q?4e9AyyJt6jSRGQTIe8soJu9gzUPUjnbA8jZo+o+pc63u8IujiPlXpQH+j1o4rluP/?= =?utf-8?q?SXU9lrxjds6/jis6kLD9JQxoNC5JP7XvYXgQ/flWbU1Yws+k2t18YU7WaJhc0R3ol?= =?utf-8?q?c5MEC45o8zHrRbc7o+pgzZdPaWqaS0jeaMHIlm9QTcSBvqJ9LCsKzjShlpxrjRH1G?= =?utf-8?q?lWQz9VG2ANWmb27i+UDLjZ6FkJyIFSXsQD1aU9GUXkOIkeZhc/5ReUD7ylzmfhqud?= =?utf-8?q?csk6DvPD6BSugbT+9ZQxi82mI6L37PNxcAn292OjyFKjgyWwg8Htl4sv1z6Fk1biB?= =?utf-8?q?24W5w9sECBmI7wFZ3Iq1klH6xr8vcXpe/R2H7h/frLyQoGzOJN23wADs8+Rv8yb/G?= =?utf-8?q?AIXb/BjCGUufE5z5o5+f1OliM3fgpuDsnoYzI5b2ohlxhmLxV2bG2/OnBSKuh1kjk?= =?utf-8?q?BAC8pGpXBLIzMVsXM7WFjeAHBnJY3nn/7kWEI3GoUq1Da6d4GspE+UnPzpdGxYp5S?= =?utf-8?q?yKfXCZLiCqg?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR15MB5819.namprd15.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(10070799003)(1800799024)(366016)(376014)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?0ZC1HJU8TzibNnw+J3L2+/8d2Rha?= =?utf-8?q?rBz4BkN8gILaKqHUV8hXsZO0DQ6ltItQBv30phRYf7/7KgZNTo3EF2Ry4/penqDxt?= =?utf-8?q?lLuL5KehyUyDuh51upI1PAZlgsKI6lplXtw7cu8VM7dAqrJfOxIqNTJpvnpAWbQJ2?= =?utf-8?q?I8QW3XsbooMurivd8i6+WEGf1+M7M7eEoew9U+KpkNBNWk7/jEoqcAmzjM8qYYEMP?= =?utf-8?q?k3y6bYPLYB+m+pcwY/p41Ju7+TT5ez5916etv1j7SeGmba3ZWvCpKAeKB4bKkpjbN?= =?utf-8?q?xOHuM5I/KJuA7KJR7/aFYo8thIIQOpgqoqhqzbYil/IzeEAg2B/99nwCiKPkdjXu8?= =?utf-8?q?sHyn8wXzoWyvkFy6Se558k7QKrloBm1ZOOcLBNdm8/V209BlFQb2HMsTGu0mlLoRd?= =?utf-8?q?v9WtWOoDSIagxhBqXFPJi+19tAJ3f1v51Tv3IAA/XPx7pf6nFg5ysiBPptpljo0zR?= =?utf-8?q?YZyv4Z+vj+keqdFoj201IcCvBTgw2GOKVKSS+0jho2Ebk5ogj2ZzhJqTo0gTfEaZM?= =?utf-8?q?HmysR+PAREKfrupGQhp7f3mLCRIfrM/zYnCF574v0qAaqAxgSvGOdzjCJ8vSi1YbQ?= =?utf-8?q?m9EFlXj1bEP2h9DNJWzjGzUK1DBCgXlaWvzYwBiKDDtjkEVtJGOxhMae0ba2W7we2?= =?utf-8?q?QgbO4P+VLW9iKlcWRW1XeF5JlPthS0sq/qsKxHFqS8acAgkwRVlRw+1KItFWItVip?= =?utf-8?q?Mk63ob+qlCi8fjD3HKC4rOUTXfwb/1kupxQgWJPo6Y1KZgVXWCNdBeBQ1X4NOpAzu?= =?utf-8?q?cUt4GIwm7lXUV+Gwd6k17Vd/OE7CLMmzZ9rl+lHa1VWjnl8jbjWcqL/sfP/WoDknn?= =?utf-8?q?b7e3OcVfHwyYZoJB3SYrsr4ZKv70vJc4SE9woIYEMVpNP/B3cgUW9bdnfmJWirMmX?= =?utf-8?q?xBBYkGpRv4tzeHWe5gDHmzmlVC8XGGoJCD63+OpZjlHOw/s6ez+Zpt9jWGBRBcqhK?= =?utf-8?q?slebBCbJNQmtB8tbfkv6zE8hPH/RlMPUqGJ/lshGPmyoqN3W2vY+b6PEPhx+o/Gbs?= =?utf-8?q?y0n81kRXTMFyHHa+ZLyaU1ANQTj5GFb+9wMB3mck6lslmesobLY67NRacY5dZMD5b?= =?utf-8?q?NtDWTvUJ7SviyFAUdt+56bZz5gf/Pr1OQgUB1uKH9/9cQeDkJPpvGhBFDY5Hw9joa?= =?utf-8?q?4Xkegac+eedqxG/qb1SUlUZOKqK08OJHJl7MBfHGbgiQ43EXapcjlNGxy8xK/mAVG?= =?utf-8?q?yMry2yn5gsiv+e7xQdUynNLhQuZMu0Nkj7eqrmAwfE8lFgdKG5FL9HapKWNOzp8Vw?= =?utf-8?q?GDrJl0sGza/gy5ORIRypKW/SRDxH/4Us9Wa/3Y/Pq+VBUxcS/6jfVX/cG8jZQ716J?= =?utf-8?q?UaR6FMQTt33UC846TZ4l1+xUr5vzRI7dqllXPyxpDlugTYqclXGXdnLsUWPzUqAX5?= =?utf-8?q?LanSsheIs4DpH4WQa+3wq8AgBm0fk9oeCTV1CPiHfZmW6JXLGpfQfDRZIh34IMwlw?= =?utf-8?q?1Y58A2JykTdp4/Fa3VJyOJYBiFA59Xi0ij0TKkzZNSEdXcKmyMBpkD/HGG5gSNZXL?= =?utf-8?q?t9Q2orm7eI+1mUJJZ/i4fqaHnQQeIXIh2C1yOU1DGMBf5cXWpzCAIyk=3D?= Content-ID: <3D95C21B9570A444926C75CF28C4C0DB@namprd15.prod.outlook.com> Precedence: bulk X-Mailing-List: ceph-devel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: ibm.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR15MB5819.namprd15.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 52325601-803a-4ffb-9cc4-08dd35a6ae61 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jan 2025 20:53:36.2890 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: fcf67057-50c9-4ad4-98f3-ffca64add9e9 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: mkL9Cv8AKHO8+Dx81DLSL/NZLDJl0+HqlDvXxjmLFXBZ4xLww7oDnu3/cND2GSbsV74HtU99rk7NSasuUjE6/g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR15MB5468 X-Proofpoint-GUID: 8ioUChI6b-N4H3WbAIvDfb58DZ0cgNw4 X-Proofpoint-ORIG-GUID: 4hGfLfnYcuvAUZujSdS9j55pyAvosFpl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-15_09,2025-01-15_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 clxscore=1015 phishscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxscore=0 impostorscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501150148 Hello, The libceph subsystem can generate enourmous amount of messages in the case of error. As a result, system log can be unreasonably big because of such messaging policy. This patch switches on ratelimited version of pr_notice(), pr_info(), pr_warn(), and pr_err() methods by means of introducing libceph_notice(), libceph_info(), libceph_warn(), and libceph_err() methods. Signed-off-by: Viacheslav Dubeyko --- include/linux/ceph/ceph_debug.h | 9 ++ net/ceph/auth.c | 70 ++++++------ net/ceph/auth_x.c | 19 ++-- net/ceph/ceph_common.c | 13 +-- net/ceph/crypto.c | 8 +- net/ceph/decode.c | 8 +- net/ceph/messenger.c | 17 +-- net/ceph/messenger_v1.c | 96 +++++++++-------- net/ceph/messenger_v2.c | 185 +++++++++++++++++--------------- net/ceph/mon_client.c | 39 +++---- net/ceph/msgpool.c | 7 +- net/ceph/osd_client.c | 120 +++++++++++---------- net/ceph/osdmap.c | 48 ++++----- 13 files changed, 338 insertions(+), 301 deletions(-) goto bad; } c->max_buckets = ceph_decode_32(p); @@ -795,11 +795,11 @@ static int decode_pool(void **p, void *end, struct ceph_pg_pool_info *pi) ev = ceph_decode_8(p); /* encoding version */ cv = ceph_decode_8(p); /* compat version */ if (ev < 5) { - pr_warn("got v %d < 5 cv %d of ceph_pg_pool\n", ev, cv); + libceph_warn("got v %d < 5 cv %d of ceph_pg_pool\n", ev, cv); return -EINVAL; } if (cv > 9) { - pr_warn("got v %d cv %d > 9 of ceph_pg_pool\n", ev, cv); + libceph_warn("got v %d cv %d > 9 of ceph_pg_pool\n", ev, cv); return -EINVAL; } len = ceph_decode_32(p); @@ -1298,9 +1298,9 @@ static int get_osdmap_client_data_v(void **p, void *end, ceph_decode_8_safe(p, end, struct_compat, e_inval); if (struct_compat > OSDMAP_WRAPPER_COMPAT_VER) { - pr_warn("got v %d cv %d > %d of %s ceph_osdmap\n", - struct_v, struct_compat, - OSDMAP_WRAPPER_COMPAT_VER, prefix); + libceph_warn("got v %d cv %d > %d of %s ceph_osdmap\n", + struct_v, struct_compat, + OSDMAP_WRAPPER_COMPAT_VER, prefix); return -EINVAL; } *p += 4; /* ignore wrapper struct_len */ @@ -1308,9 +1308,9 @@ static int get_osdmap_client_data_v(void **p, void *end, ceph_decode_8_safe(p, end, struct_v, e_inval); ceph_decode_8_safe(p, end, struct_compat, e_inval); if (struct_compat > OSDMAP_CLIENT_DATA_COMPAT_VER) { - pr_warn("got v %d cv %d > %d of %s ceph_osdmap client data\n", - struct_v, struct_compat, - OSDMAP_CLIENT_DATA_COMPAT_VER, prefix); + libceph_warn("got v %d cv %d > %d of %s ceph_osdmap client data\n", + struct_v, struct_compat, + OSDMAP_CLIENT_DATA_COMPAT_VER, prefix); return -EINVAL; } *p += 4; /* ignore client data struct_len */ @@ -1320,8 +1320,8 @@ static int get_osdmap_client_data_v(void **p, void *end, *p -= 1; ceph_decode_16_safe(p, end, version, e_inval); if (version < 6) { - pr_warn("got v %d < 6 of %s ceph_osdmap\n", - version, prefix); + libceph_warn("got v %d < 6 of %s ceph_osdmap\n", + version, prefix); return -EINVAL; } @@ -1803,8 +1803,8 @@ static int osdmap_decode(void **p, void *end, bool msgr2, e_inval: err = -EINVAL; bad: - pr_err("corrupt full osdmap (%d) epoch %d off %d (%p of %p- %p)\n", - err, epoch, (int)(*p - start), *p, start, end); + libceph_err("corrupt full osdmap (%d) epoch %d off %d (%p of %p-%p)\n", + err, epoch, (int)(*p - start), *p, start, end); print_hex_dump(KERN_DEBUG, "osdmap: ", DUMP_PREFIX_OFFSET, 16, 1, start, end - start, true); @@ -2107,8 +2107,8 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, bool msgr2, e_inval: err = -EINVAL; bad: - pr_err("corrupt inc osdmap (%d) epoch %d off %d (%p of %p- %p)\n", - err, epoch, (int)(*p - start), *p, start, end); + libceph_err("corrupt inc osdmap (%d) epoch %d off %d (%p of %p-%p)\n", + err, epoch, (int)(*p - start), *p, start, end); print_hex_dump(KERN_DEBUG, "osdmap: ", DUMP_PREFIX_OFFSET, 16, 1, start, end - start, true); @@ -2563,24 +2563,24 @@ static void pg_to_raw_osds(struct ceph_osdmap *osdmap, ruleno = crush_find_rule(osdmap->crush, pi->crush_ruleset, pi- >type, pi->size); if (ruleno < 0) { - pr_err("no crush rule: pool %lld ruleset %d type %d size %d\n", - pi->id, pi->crush_ruleset, pi->type, pi->size); + libceph_err("no crush rule: pool %lld ruleset %d type %d size %d\n", + pi->id, pi->crush_ruleset, pi->type, pi- >size); return; } if (pi->size > ARRAY_SIZE(raw->osds)) { - pr_err_ratelimited("pool %lld ruleset %d type %d too wide: size %d > %zu\n", - pi->id, pi->crush_ruleset, pi->type, pi->size, - ARRAY_SIZE(raw->osds)); + libceph_err("pool %lld ruleset %d type %d too wide: size %d > %zu\n", + pi->id, pi->crush_ruleset, pi->type, pi- >size, + ARRAY_SIZE(raw->osds)); return; } len = do_crush(osdmap, ruleno, pps, raw->osds, pi->size, osdmap->osd_weight, osdmap->max_osd, pi->id); if (len < 0) { - pr_err("error %d from crush rule %d: pool %lld ruleset %d type %d size %d\n", - len, ruleno, pi->id, pi->crush_ruleset, pi- >type, - pi->size); + libceph_err("error %d from crush rule %d: pool %lld ruleset %d type %d size %d\n", + len, ruleno, pi->id, pi->crush_ruleset, pi->type, + pi->size); return; } diff --git a/include/linux/ceph/ceph_debug.h b/include/linux/ceph/ceph_debug.h index 5f904591fa5f..4a52e7a99164 100644 --- a/include/linux/ceph/ceph_debug.h +++ b/include/linux/ceph/ceph_debug.h @@ -70,4 +70,13 @@ pr_err_ratelimited("[%pU %llu]: " fmt, &client- >fsid, \ client->monc.auth->global_id, ##__VA_ARGS__) +#define libceph_notice(fmt, ...) \ + pr_notice_ratelimited(fmt, ##__VA_ARGS__) +#define libceph_info(fmt, ...) \ + pr_info_ratelimited(fmt, ##__VA_ARGS__) +#define libceph_warn(fmt, ...) \ + pr_warn_ratelimited(fmt, ##__VA_ARGS__) +#define libceph_err(fmt, ...) \ + pr_err_ratelimited(fmt, ##__VA_ARGS__) + #endif diff --git a/net/ceph/auth.c b/net/ceph/auth.c index d38c9eadbe2f..ab8b5b5c2ee4 100644 --- a/net/ceph/auth.c +++ b/net/ceph/auth.c @@ -31,7 +31,7 @@ static int init_protocol(struct ceph_auth_client *ac, int proto) case CEPH_AUTH_CEPHX: return ceph_x_init(ac); default: - pr_err("bad auth protocol %d\n", proto); + libceph_err("bad auth protocol %d\n", proto); return -EINVAL; } } @@ -41,11 +41,12 @@ void ceph_auth_set_global_id(struct ceph_auth_client *ac, u64 global_id) dout("%s global_id %llu\n", __func__, global_id); if (!global_id) - pr_err("got zero global_id\n"); + libceph_err("got zero global_id\n"); - if (ac->global_id && global_id != ac->global_id) - pr_err("global_id changed from %llu to %llu\n", ac- >global_id, - global_id); + if (ac->global_id && global_id != ac->global_id) { + libceph_err("global_id changed from %llu to %llu\n", ac->global_id, + global_id); + } ac->global_id = global_id; } @@ -180,8 +181,8 @@ static int build_request(struct ceph_auth_client *ac, bool add_header, ceph_encode_need(&p, end, sizeof(u32), e_range); ret = ac->ops->build_request(ac, p + sizeof(u32), end); if (ret < 0) { - pr_err("auth protocol '%s' building request failed: %d\n", - ceph_auth_proto_name(ac->protocol), ret); + libceph_err("auth protocol '%s' building request failed: %d\n", + ceph_auth_proto_name(ac->protocol), ret); return ret; } dout(" built request %d bytes\n", ret); @@ -246,8 +247,9 @@ int ceph_handle_auth_reply(struct ceph_auth_client *ac, if (ac->protocol != protocol) { ret = init_protocol(ac, protocol); if (ret) { - pr_err("auth protocol '%s' init failed: %d\n", - ceph_auth_proto_name(protocol), ret); + libceph_err("auth protocol '%s' init failed: %d\n", + ceph_auth_proto_name(protocol), + ret); goto out; } } @@ -256,8 +258,8 @@ int ceph_handle_auth_reply(struct ceph_auth_client *ac, } if (result) { - pr_err("auth protocol '%s' mauth authentication failed: %d\n", - ceph_auth_proto_name(ac->protocol), result); + libceph_err("auth protocol '%s' mauth authentication failed: %d\n", + ceph_auth_proto_name(ac->protocol), result); ret = result; goto out; } @@ -276,7 +278,7 @@ int ceph_handle_auth_reply(struct ceph_auth_client *ac, return ret; bad: - pr_err("failed to decode auth msg\n"); + libceph_err("failed to decode auth msg\n"); ret = -EINVAL; goto out; } @@ -436,8 +438,8 @@ int ceph_auth_get_request(struct ceph_auth_client *ac, void *buf, int buf_len) if (ac->protocol == CEPH_AUTH_UNKNOWN) { ret = init_protocol(ac, proto); if (ret) { - pr_err("auth protocol '%s' init failed: %d\n", - ceph_auth_proto_name(proto), ret); + libceph_err("auth protocol '%s' init failed: %d\n", + ceph_auth_proto_name(proto), ret); goto out; } } else { @@ -514,27 +516,27 @@ bool ceph_auth_handle_bad_method(struct ceph_auth_client *ac, if (result == -EOPNOTSUPP) { if (!contains(allowed_protos, proto_cnt, ac- >protocol)) { - pr_err("auth protocol '%s' not allowed\n", - ceph_auth_proto_name(ac->protocol)); + libceph_err("auth protocol '%s' not allowed\n", + ceph_auth_proto_name(ac- >protocol)); goto not_allowed; } if (!contains(allowed_modes, mode_cnt, ac- >preferred_mode) && (ac->fallback_mode == CEPH_CON_MODE_UNKNOWN || !contains(allowed_modes, mode_cnt, ac- >fallback_mode))) { - pr_err("preferred mode '%s' not allowed\n", - ceph_con_mode_name(ac- >preferred_mode)); + libceph_err("preferred mode '%s' not allowed\n", + ceph_con_mode_name(ac- >preferred_mode)); if (ac->fallback_mode == CEPH_CON_MODE_UNKNOWN) - pr_err("no fallback mode\n"); + libceph_err("no fallback mode\n"); else - pr_err("fallback mode '%s' not allowed\n", - ceph_con_mode_name(ac- >fallback_mode)); + libceph_err("fallback mode '%s' not allowed\n", + ceph_con_mode_name(ac- >fallback_mode)); goto not_allowed; } } WARN_ON(result == -EOPNOTSUPP || result >= 0); - pr_err("auth protocol '%s' msgr authentication failed: %d\n", - ceph_auth_proto_name(ac->protocol), result); + libceph_err("auth protocol '%s' msgr authentication failed: %d\n", + ceph_auth_proto_name(ac->protocol), result); mutex_unlock(&ac->mutex); return true; @@ -620,21 +622,21 @@ bool ceph_auth_handle_bad_authorizer(struct ceph_auth_client *ac, if (result == -EOPNOTSUPP) { if (!contains(allowed_protos, proto_cnt, ac- >protocol)) { - pr_err("auth protocol '%s' not allowed by %s\n", - ceph_auth_proto_name(ac->protocol), - ceph_entity_type_name(peer_type)); + libceph_err("auth protocol '%s' not allowed by %s\n", + ceph_auth_proto_name(ac- >protocol), + ceph_entity_type_name(peer_type)); goto not_allowed; } if (!contains(allowed_modes, mode_cnt, ac- >preferred_mode) && (ac->fallback_mode == CEPH_CON_MODE_UNKNOWN || !contains(allowed_modes, mode_cnt, ac- >fallback_mode))) { - pr_err("preferred mode '%s' not allowed by %s\n", - ceph_con_mode_name(ac->preferred_mode), - ceph_entity_type_name(peer_type)); + libceph_err("preferred mode '%s' not allowed by %s\n", + ceph_con_mode_name(ac- >preferred_mode), + ceph_entity_type_name(peer_type)); if (ac->fallback_mode == CEPH_CON_MODE_UNKNOWN) - pr_err("no fallback mode\n"); + libceph_err("no fallback mode\n"); else - pr_err("fallback mode '%s' not allowed by %s\n", + libceph_err("fallback mode '%s' not allowed by %s\n", ceph_con_mode_name(ac- >fallback_mode), ceph_entity_type_name(peer_type)); goto not_allowed; @@ -642,9 +644,9 @@ bool ceph_auth_handle_bad_authorizer(struct ceph_auth_client *ac, } WARN_ON(result == -EOPNOTSUPP || result >= 0); - pr_err("auth protocol '%s' authorization to %s failed: %d\n", - ceph_auth_proto_name(ac->protocol), - ceph_entity_type_name(peer_type), result); + libceph_err("auth protocol '%s' authorization to %s failed: %d\n", + ceph_auth_proto_name(ac->protocol), + ceph_entity_type_name(peer_type), result); if (ac->ops->invalidate_authorizer) ac->ops->invalidate_authorizer(ac, peer_type); diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c index b71b1635916e..3fe4bccd2fd5 100644 --- a/net/ceph/auth_x.c +++ b/net/ceph/auth_x.c @@ -87,7 +87,7 @@ static int __ceph_x_decrypt(struct ceph_crypto_key *secret, void *p, return ret; if (le64_to_cpu(hdr->magic) != CEPHX_ENC_MAGIC) { - pr_err("%s bad magic\n", __func__); + libceph_err("%s bad magic\n", __func__); return -EINVAL; } @@ -402,7 +402,7 @@ static int ceph_x_build_authorizer(struct ceph_auth_client *ac, get_random_bytes(&au->nonce, sizeof(au->nonce)); ret = encrypt_authorizer(au, NULL); if (ret) { - pr_err("failed to encrypt authorizer: %d", ret); + libceph_err("failed to encrypt authorizer: %d", ret); goto out_au; } @@ -580,7 +580,7 @@ static int decode_con_secret(void **p, void *end, u8 *con_secret, dout("%s len %d\n", __func__, len); if (con_secret) { if (len > CEPH_MAX_CON_SECRET_LEN) { - pr_err("connection secret too big %d\n", len); + libceph_err("connection secret too big %d\n", len); goto bad_memzero; } memcpy(con_secret, *p, len); @@ -593,7 +593,7 @@ static int decode_con_secret(void **p, void *end, u8 *con_secret, bad_memzero: memzero_explicit(*p, len); bad: - pr_err("failed to decode connection secret\n"); + libceph_err("failed to decode connection secret\n"); return -EINVAL; } @@ -825,13 +825,14 @@ static int ceph_x_add_authorizer_challenge(struct ceph_auth_client *ac, ret = decrypt_authorizer_challenge(&au->session_key, challenge, challenge_len, &server_challenge); if (ret) { - pr_err("failed to decrypt authorize challenge: %d", ret); + libceph_err("failed to decrypt authorize challenge: %d", ret); return ret; } ret = encrypt_authorizer(au, &server_challenge); if (ret) { - pr_err("failed to encrypt authorizer w/ challenge: %d", ret); + libceph_err("failed to encrypt authorizer w/ challenge: %d", + ret); return ret; } @@ -894,7 +895,7 @@ static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac, return ret; if (nonce_plus_one != au->nonce + 1) { - pr_err("failed to authenticate server\n"); + libceph_err("failed to authenticate server\n"); return -EPERM; } @@ -1097,13 +1098,13 @@ int ceph_x_init(struct ceph_auth_client *ac) ret = -EINVAL; if (!ac->key) { - pr_err("no secret set (for auth_x protocol)\n"); + libceph_err("no secret set (for auth_x protocol)\n"); goto out_nomem; } ret = ceph_crypto_key_clone(&xi->secret, ac->key); if (ret < 0) { - pr_err("cannot clone key: %d\n", ret); + libceph_err("cannot clone key: %d\n", ret); goto out_nomem; } diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 4c6441536d55..2420b938d69a 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c @@ -106,8 +106,8 @@ int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid) { if (client->have_fsid) { if (ceph_fsid_compare(&client->fsid, fsid)) { - pr_err("bad fsid, had %pU got %pU", - &client->fsid, fsid); + libceph_err("bad fsid, had %pU got %pU", + &client->fsid, fsid); return -1; } } else { @@ -822,8 +822,9 @@ int __ceph_open_session(struct ceph_client *client, unsigned long started) return client->auth_err; } - pr_info("client%llu fsid %pU\n", ceph_client_gid(client), - &client->fsid); + libceph_info("client%llu fsid %pU\n", + ceph_client_gid(client), + &client->fsid); ceph_debugfs_client_init(client); return 0; @@ -881,8 +882,8 @@ static int __init init_ceph_lib(void) if (ret < 0) goto out_msgr; - pr_info("loaded (mon/osd proto %d/%d)\n", - CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL); + libceph_info("loaded (mon/osd proto %d/%d)\n", + CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL); return 0; diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c index 01b2ce1e8fc0..c0540cf040d4 100644 --- a/net/ceph/crypto.c +++ b/net/ceph/crypto.c @@ -239,8 +239,8 @@ static int ceph_aes_crypt(const struct ceph_crypto_key *key, bool encrypt, ret = crypto_skcipher_decrypt(req); skcipher_request_zero(req); if (ret) { - pr_err("%s %scrypt failed: %d\n", __func__, - encrypt ? "en" : "de", ret); + libceph_err("%s %scrypt failed: %d\n", __func__, + encrypt ? "en" : "de", ret); goto out_sgt; } /* @@ -256,8 +256,8 @@ static int ceph_aes_crypt(const struct ceph_crypto_key *key, bool encrypt, in_len >= pad_byte) { *pout_len = in_len - pad_byte; } else { - pr_err("%s got bad padding %d on in_len %d\n", - __func__, pad_byte, in_len); + libceph_err("%s got bad padding %d on in_len %d\n", + __func__, pad_byte, in_len); ret = -EPERM; goto out_sgt; } diff --git a/net/ceph/decode.c b/net/ceph/decode.c index bc109a1a4616..34bab30c6bc4 100644 --- a/net/ceph/decode.c +++ b/net/ceph/decode.c @@ -106,7 +106,7 @@ int ceph_decode_entity_addrvec(void **p, void *end, bool msgr2, ceph_decode_8_safe(p, end, marker, e_inval); if (marker != 2) { - pr_err("bad addrvec marker %d\n", marker); + libceph_err("bad addrvec marker %d\n", marker); return -EINVAL; } @@ -122,8 +122,8 @@ int ceph_decode_entity_addrvec(void **p, void *end, bool msgr2, dout("%s i %d addr %s\n", __func__, i, ceph_pr_addr(&tmp_addr)); if (tmp_addr.type == my_type) { if (found) { - pr_err("another match of type %d in addrvec\n", - le32_to_cpu(my_type)); + libceph_err("another match of type %d in addrvec\n", + le32_to_cpu(my_type)); return -EINVAL; } @@ -141,7 +141,7 @@ int ceph_decode_entity_addrvec(void **p, void *end, bool msgr2, if (addr_cnt == 1 && !memchr_inv(&tmp_addr, 0, sizeof(tmp_addr))) return 0; /* weird but effectively the same as !addr_cnt */ - pr_err("no match of type %d in addrvec\n", le32_to_cpu(my_type)); + libceph_err("no match of type %d in addrvec\n", le32_to_cpu(my_type)); return -ENOENT; e_inval: diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index d1b5705dc0c6..fc1f843acb78 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -256,7 +256,7 @@ int __init ceph_msgr_init(void) if (ceph_msgr_wq) return 0; - pr_err("msgr_init failed to create workqueue\n"); + libceph_err("msgr_init failed to create workqueue\n"); _ceph_msgr_exit(); return -ENOMEM; @@ -466,8 +466,8 @@ int ceph_tcp_connect(struct ceph_connection *con) ceph_pr_addr(&con->peer_addr), sock->sk->sk_state); } else if (ret < 0) { - pr_err("connect %s error %d\n", - ceph_pr_addr(&con->peer_addr), ret); + libceph_err("connect %s error %d\n", + ceph_pr_addr(&con->peer_addr), ret); sock_release(sock); return ret; } @@ -1278,7 +1278,8 @@ static int ceph_dns_resolve_name(const char *name, size_t namelen, *ipend = end; - pr_info("resolve '%.*s' (ret=%d): %s\n", (int)(end - name), name, + libceph_info("resolve '%.*s' (ret=%d): %s\n", + (int)(end - name), name, ret, ret ? "failed" : ceph_pr_addr(addr)); return ret; @@ -1616,8 +1617,8 @@ static void con_fault(struct ceph_connection *con) dout("fault %p state %d to peer %s\n", con, con->state, ceph_pr_addr(&con->peer_addr)); - pr_warn("%s%lld %s %s\n", ENTITY_NAME(con->peer_name), - ceph_pr_addr(&con->peer_addr), con->error_msg); + libceph_warn("%s%lld %s %s\n", ENTITY_NAME(con->peer_name), + ceph_pr_addr(&con->peer_addr), con->error_msg); con->error_msg = NULL; WARN_ON(con->state == CEPH_CON_S_STANDBY || @@ -2006,8 +2007,8 @@ struct ceph_msg *ceph_msg_new2(int type, int front_len, int max_data_items, ceph_msg_put(m); out: if (!can_fail) { - pr_err("msg_new can't create type %d front %d\n", type, - front_len); + libceph_err("msg_new can't create type %d front %d\n", type, + front_len); WARN_ON(1); } else { dout("msg_new can't create type %d front %d\n", type, diff --git a/net/ceph/messenger_v1.c b/net/ceph/messenger_v1.c index 0cb61c76b9b8..99ce08fe5eef 100644 --- a/net/ceph/messenger_v1.c +++ b/net/ceph/messenger_v1.c @@ -663,8 +663,9 @@ static int read_partial_connect(struct ceph_connection *con) if (con->v1.auth) { size = le32_to_cpu(con->v1.in_reply.authorizer_len); if (size > con->v1.auth->authorizer_reply_buf_len) { - pr_err("authorizer reply too big: %d > %zu\n", size, - con->v1.auth- >authorizer_reply_buf_len); + libceph_err("authorizer reply too big: %d > %zu\n", + size, + con->v1.auth- >authorizer_reply_buf_len); ret = -EINVAL; goto out; } @@ -690,8 +691,8 @@ static int read_partial_connect(struct ceph_connection *con) static int verify_hello(struct ceph_connection *con) { if (memcmp(con->v1.in_banner, CEPH_BANNER, strlen(CEPH_BANNER))) { - pr_err("connect to %s got bad banner\n", - ceph_pr_addr(&con->peer_addr)); + libceph_err("connect to %s got bad banner\n", + ceph_pr_addr(&con->peer_addr)); con->error_msg = "protocol error, bad banner"; return -1; } @@ -716,11 +717,11 @@ static int process_banner(struct ceph_connection *con) sizeof(con->peer_addr)) != 0 && !(ceph_addr_is_blank(&con->v1.actual_peer_addr) && con->v1.actual_peer_addr.nonce == con->peer_addr.nonce)) { - pr_warn("wrong peer, want %s/%u, got %s/%u\n", - ceph_pr_addr(&con->peer_addr), - le32_to_cpu(con->peer_addr.nonce), - ceph_pr_addr(&con->v1.actual_peer_addr), - le32_to_cpu(con->v1.actual_peer_addr.nonce)); + libceph_warn("wrong peer, want %s/%u, got %s/%u\n", + ceph_pr_addr(&con->peer_addr), + le32_to_cpu(con->peer_addr.nonce), + ceph_pr_addr(&con->v1.actual_peer_addr), + le32_to_cpu(con- >v1.actual_peer_addr.nonce)); con->error_msg = "wrong peer at address"; return -1; } @@ -784,21 +785,21 @@ static int process_connect(struct ceph_connection *con) switch (con->v1.in_reply.tag) { case CEPH_MSGR_TAG_FEATURES: - pr_err("%s%lld %s feature set mismatch," - " my %llx < server's %llx, missing %llx\n", - ENTITY_NAME(con->peer_name), - ceph_pr_addr(&con->peer_addr), - sup_feat, server_feat, server_feat & ~sup_feat); + libceph_err("%s%lld %s feature set mismatch," + " my %llx < server's %llx, missing %llx\n", + ENTITY_NAME(con->peer_name), + ceph_pr_addr(&con->peer_addr), + sup_feat, server_feat, server_feat & ~sup_feat); con->error_msg = "missing required protocol features"; return -1; case CEPH_MSGR_TAG_BADPROTOVER: - pr_err("%s%lld %s protocol version mismatch," - " my %d != server's %d\n", - ENTITY_NAME(con->peer_name), - ceph_pr_addr(&con->peer_addr), - le32_to_cpu(con- >v1.out_connect.protocol_version), - le32_to_cpu(con- >v1.in_reply.protocol_version)); + libceph_err("%s%lld %s protocol version mismatch," + " my %d != server's %d\n", + ENTITY_NAME(con->peer_name), + ceph_pr_addr(&con->peer_addr), + le32_to_cpu(con- >v1.out_connect.protocol_version), + le32_to_cpu(con- >v1.in_reply.protocol_version)); con->error_msg = "protocol version mismatch"; return -1; @@ -827,9 +828,9 @@ static int process_connect(struct ceph_connection *con) */ dout("process_connect got RESET peer seq %u\n", le32_to_cpu(con->v1.in_reply.connect_seq)); - pr_info("%s%lld %s session reset\n", - ENTITY_NAME(con->peer_name), - ceph_pr_addr(&con->peer_addr)); + libceph_info("%s%lld %s session reset\n", + ENTITY_NAME(con->peer_name), + ceph_pr_addr(&con->peer_addr)); ceph_con_reset_session(con); con_out_kvec_reset(con); ret = prepare_write_connect(con); @@ -882,11 +883,12 @@ static int process_connect(struct ceph_connection *con) case CEPH_MSGR_TAG_SEQ: case CEPH_MSGR_TAG_READY: if (req_feat & ~server_feat) { - pr_err("%s%lld %s protocol feature mismatch," - " my required %llx > server's %llx, need %llx\n", - ENTITY_NAME(con->peer_name), - ceph_pr_addr(&con->peer_addr), - req_feat, server_feat, req_feat & ~server_feat); + libceph_err("%s%lld %s protocol feature mismatch," + " my required %llx > server's %llx, need %llx\n", + ENTITY_NAME(con->peer_name), + ceph_pr_addr(&con->peer_addr), + req_feat, server_feat, + req_feat & ~server_feat); con->error_msg = "missing required protocol features"; return -1; } @@ -1000,7 +1002,7 @@ static int read_partial_sparse_msg_extent(struct ceph_connection *con, u32 *crc) if (do_bounce && unlikely(!con->bounce_page)) { con->bounce_page = alloc_page(GFP_NOIO); if (!con->bounce_page) { - pr_err("failed to allocate bounce page\n"); + libceph_err("failed to allocate bounce page\n"); return -ENOMEM; } } @@ -1112,7 +1114,7 @@ static int read_partial_msg_data_bounce(struct ceph_connection *con) if (unlikely(!con->bounce_page)) { con->bounce_page = alloc_page(GFP_NOIO); if (!con->bounce_page) { - pr_err("failed to allocate bounce page\n"); + libceph_err("failed to allocate bounce page\n"); return -ENOMEM; } } @@ -1167,8 +1169,8 @@ static int read_partial_message(struct ceph_connection *con) crc = crc32c(0, &con->v1.in_hdr, offsetof(struct ceph_msg_header, crc)); if (cpu_to_le32(crc) != con->v1.in_hdr.crc) { - pr_err("read_partial_message bad hdr crc %u != expected %u\n", - crc, con->v1.in_hdr.crc); + libceph_err("read_partial_message bad hdr crc %u != expected %u\n", + crc, con->v1.in_hdr.crc); return -EBADMSG; } @@ -1185,17 +1187,17 @@ static int read_partial_message(struct ceph_connection *con) /* verify seq# */ seq = le64_to_cpu(con->v1.in_hdr.seq); if ((s64)seq - (s64)con->in_seq < 1) { - pr_info("skipping %s%lld %s seq %lld expected %lld\n", - ENTITY_NAME(con->peer_name), - ceph_pr_addr(&con->peer_addr), - seq, con->in_seq + 1); + libceph_info("skipping %s%lld %s seq %lld expected %lld\n", + ENTITY_NAME(con->peer_name), + ceph_pr_addr(&con->peer_addr), + seq, con->in_seq + 1); con->v1.in_base_pos = -front_len - middle_len - data_len - sizeof_footer(con); con->v1.in_tag = CEPH_MSGR_TAG_READY; return 1; } else if ((s64)seq - (s64)con->in_seq > 1) { - pr_err("read_partial_message bad seq %lld expected %lld\n", - seq, con->in_seq + 1); + libceph_err("read_partial_message bad seq %lld expected %lld\n", + seq, con->in_seq + 1); con->error_msg = "bad message sequence # for incoming message"; return -EBADE; } @@ -1282,26 +1284,28 @@ static int read_partial_message(struct ceph_connection *con) /* crc ok? */ if (con->in_front_crc != le32_to_cpu(m->footer.front_crc)) { - pr_err("read_partial_message %p front crc %u != exp. %u\n", - m, con->in_front_crc, m->footer.front_crc); + libceph_err("read_partial_message %p front crc %u != exp. %u\n", + m, con->in_front_crc, m- >footer.front_crc); return -EBADMSG; } if (con->in_middle_crc != le32_to_cpu(m->footer.middle_crc)) { - pr_err("read_partial_message %p middle crc %u != exp %u\n", - m, con->in_middle_crc, m->footer.middle_crc); + libceph_err("read_partial_message %p middle crc %u != exp %u\n", + m, con->in_middle_crc, m- >footer.middle_crc); return -EBADMSG; } if (do_datacrc && (m->footer.flags & CEPH_MSG_FOOTER_NOCRC) == 0 && con->in_data_crc != le32_to_cpu(m->footer.data_crc)) { - pr_err("read_partial_message %p data crc %u != exp. %u\n", m, - con->in_data_crc, le32_to_cpu(m- >footer.data_crc)); + libceph_err("read_partial_message %p data crc %u != exp. %u\n", + m, con->in_data_crc, + le32_to_cpu(m->footer.data_crc)); return -EBADMSG; } if (need_sign && con->ops->check_message_signature && con->ops->check_message_signature(m)) { - pr_err("read_partial_message %p signature check failed\n", m); + libceph_err("read_partial_message %p signature check failed\n", + m); return -EBADMSG; } @@ -1460,7 +1464,7 @@ int ceph_con_v1_try_read(struct ceph_connection *con) return ret; bad_tag: - pr_err("try_read bad tag %d\n", con->v1.in_tag); + libceph_err("try_read bad tag %d\n", con->v1.in_tag); con->error_msg = "protocol error, garbage tag"; ret = -1; goto out; diff --git a/net/ceph/messenger_v2.c b/net/ceph/messenger_v2.c index bd608ffa0627..418cb3e85fe7 100644 --- a/net/ceph/messenger_v2.c +++ b/net/ceph/messenger_v2.c @@ -509,8 +509,8 @@ static int decode_preamble(void *p, struct ceph_frame_desc *desc) crc = crc32c(0, p, crcp - p); expected_crc = get_unaligned_le32(crcp); if (crc != expected_crc) { - pr_err("bad preamble crc, calculated %u, expected %u\n", - crc, expected_crc); + libceph_err("bad preamble crc, calculated %u, expected %u\n", + crc, expected_crc); return -EBADMSG; } @@ -520,7 +520,7 @@ static int decode_preamble(void *p, struct ceph_frame_desc *desc) desc->fd_seg_cnt = ceph_decode_8(&p); if (desc->fd_seg_cnt < 1 || desc->fd_seg_cnt > CEPH_FRAME_MAX_SEGMENT_COUNT) { - pr_err("bad segment count %d\n", desc->fd_seg_cnt); + libceph_err("bad segment count %d\n", desc- >fd_seg_cnt); return -EINVAL; } for (i = 0; i < desc->fd_seg_cnt; i++) { @@ -530,22 +530,26 @@ static int decode_preamble(void *p, struct ceph_frame_desc *desc) if (desc->fd_lens[0] < 0 || desc->fd_lens[0] > CEPH_MSG_MAX_CONTROL_LEN) { - pr_err("bad control segment length %d\n", desc- >fd_lens[0]); + libceph_err("bad control segment length %d\n", + desc->fd_lens[0]); return -EINVAL; } if (desc->fd_lens[1] < 0 || desc->fd_lens[1] > CEPH_MSG_MAX_FRONT_LEN) { - pr_err("bad front segment length %d\n", desc- >fd_lens[1]); + libceph_err("bad front segment length %d\n", + desc->fd_lens[1]); return -EINVAL; } if (desc->fd_lens[2] < 0 || desc->fd_lens[2] > CEPH_MSG_MAX_MIDDLE_LEN) { - pr_err("bad middle segment length %d\n", desc- >fd_lens[2]); + libceph_err("bad middle segment length %d\n", + desc->fd_lens[2]); return -EINVAL; } if (desc->fd_lens[3] < 0 || desc->fd_lens[3] > CEPH_MSG_MAX_DATA_LEN) { - pr_err("bad data segment length %d\n", desc- >fd_lens[3]); + libceph_err("bad data segment length %d\n", + desc->fd_lens[3]); return -EINVAL; } @@ -554,8 +558,8 @@ static int decode_preamble(void *p, struct ceph_frame_desc *desc) * segment), but we should never get it as client. */ if (!desc->fd_lens[desc->fd_seg_cnt - 1]) { - pr_err("last segment empty, segment count %d\n", - desc->fd_seg_cnt); + libceph_err("last segment empty, segment count %d\n", + desc->fd_seg_cnt); return -EINVAL; } @@ -587,7 +591,7 @@ static int decode_epilogue(void *p, u32 *front_crc, u32 *middle_crc, if ((late_status & FRAME_LATE_STATUS_ABORTED_MASK) != FRAME_LATE_STATUS_COMPLETE) { /* we should never get an aborted message as client */ - pr_err("bad late_status 0x%x\n", late_status); + libceph_err("bad late_status 0x%x\n", late_status); return -EINVAL; } @@ -647,8 +651,8 @@ static int verify_control_crc(struct ceph_connection *con) crc = crc32c(-1, con->v2.in_kvecs[0].iov_base, ctrl_len); expected_crc = get_unaligned_le32(con- >v2.in_kvecs[1].iov_base); if (crc != expected_crc) { - pr_err("bad control crc, calculated %u, expected %u\n", - crc, expected_crc); + libceph_err("bad control crc, calculated %u, expected %u\n", + crc, expected_crc); return -EBADMSG; } @@ -682,18 +686,18 @@ static int verify_epilogue_crcs(struct ceph_connection *con, u32 front_crc, con->in_front_crc, con->in_middle_crc, con->in_data_crc); if (con->in_front_crc != front_crc) { - pr_err("bad front crc, calculated %u, expected %u\n", - con->in_front_crc, front_crc); + libceph_err("bad front crc, calculated %u, expected %u\n", + con->in_front_crc, front_crc); return -EBADMSG; } if (con->in_middle_crc != middle_crc) { - pr_err("bad middle crc, calculated %u, expected %u\n", - con->in_middle_crc, middle_crc); + libceph_err("bad middle crc, calculated %u, expected %u\n", + con->in_middle_crc, middle_crc); return -EBADMSG; } if (con->in_data_crc != data_crc) { - pr_err("bad data crc, calculated %u, expected %u\n", - con->in_data_crc, data_crc); + libceph_err("bad data crc, calculated %u, expected %u\n", + con->in_data_crc, data_crc); return -EBADMSG; } @@ -713,7 +717,7 @@ static int setup_crypto(struct ceph_connection *con, if (con->v2.con_mode != CEPH_CON_MODE_CRC && con->v2.con_mode != CEPH_CON_MODE_SECURE) { - pr_err("bad con_mode %d\n", con->v2.con_mode); + libceph_err("bad con_mode %d\n", con->v2.con_mode); return -EINVAL; } @@ -729,14 +733,14 @@ static int setup_crypto(struct ceph_connection *con, if (IS_ERR(con->v2.hmac_tfm)) { ret = PTR_ERR(con->v2.hmac_tfm); con->v2.hmac_tfm = NULL; - pr_err("failed to allocate hmac tfm context: %d\n", ret); + libceph_err("failed to allocate hmac tfm context: %d\n", ret); return ret; } ret = crypto_shash_setkey(con->v2.hmac_tfm, session_key, session_key_len); if (ret) { - pr_err("failed to set hmac key: %d\n", ret); + libceph_err("failed to set hmac key: %d\n", ret); return ret; } @@ -746,7 +750,7 @@ static int setup_crypto(struct ceph_connection *con, } if (con_secret_len < CEPH_GCM_KEY_LEN + 2 * CEPH_GCM_IV_LEN) { - pr_err("con_secret too small %d\n", con_secret_len); + libceph_err("con_secret too small %d\n", con_secret_len); return -EINVAL; } @@ -756,7 +760,7 @@ static int setup_crypto(struct ceph_connection *con, if (IS_ERR(con->v2.gcm_tfm)) { ret = PTR_ERR(con->v2.gcm_tfm); con->v2.gcm_tfm = NULL; - pr_err("failed to allocate gcm tfm context: %d\n", ret); + libceph_err("failed to allocate gcm tfm context: %d\n", ret); return ret; } @@ -764,20 +768,20 @@ static int setup_crypto(struct ceph_connection *con, crypto_aead_alignmask(con->v2.gcm_tfm)); ret = crypto_aead_setkey(con->v2.gcm_tfm, con_secret, CEPH_GCM_KEY_LEN); if (ret) { - pr_err("failed to set gcm key: %d\n", ret); + libceph_err("failed to set gcm key: %d\n", ret); return ret; } WARN_ON(crypto_aead_ivsize(con->v2.gcm_tfm) != CEPH_GCM_IV_LEN); ret = crypto_aead_setauthsize(con->v2.gcm_tfm, CEPH_GCM_TAG_LEN); if (ret) { - pr_err("failed to set gcm tag size: %d\n", ret); + libceph_err("failed to set gcm tag size: %d\n", ret); return ret; } con->v2.gcm_req = aead_request_alloc(con->v2.gcm_tfm, GFP_NOIO); if (!con->v2.gcm_req) { - pr_err("failed to allocate gcm request\n"); + libceph_err("failed to allocate gcm request\n"); return -ENOMEM; } @@ -1870,7 +1874,7 @@ static int prepare_read_data(struct ceph_connection *con) if (unlikely(!con->bounce_page)) { con->bounce_page = alloc_page(GFP_NOIO); if (!con->bounce_page) { - pr_err("failed to allocate bounce page\n"); + libceph_err("failed to allocate bounce page\n"); return -ENOMEM; } } @@ -1998,8 +2002,8 @@ static int prepare_sparse_read_cont(struct ceph_connection *con) } if (ret > cursor->total_resid) { - pr_warn("%s: ret 0x%x total_resid 0x%zx resid 0x%zx\n", - __func__, ret, cursor->total_resid, cursor- >resid); + libceph_warn("%s: ret 0x%x total_resid 0x%zx resid 0x%zx\n", + __func__, ret, cursor->total_resid, cursor->resid); return -EIO; } get_bvec_at(cursor, &bv); @@ -2009,7 +2013,7 @@ static int prepare_sparse_read_cont(struct ceph_connection *con) if (unlikely(!con->bounce_page)) { con->bounce_page = alloc_page(GFP_NOIO); if (!con->bounce_page) { - pr_err("failed to allocate bounce page\n"); + libceph_err("failed to allocate bounce page\n"); return -ENOMEM; } } @@ -2190,14 +2194,14 @@ static int process_banner_payload(struct ceph_connection *con) __func__, con, server_feat, server_req_feat); if (req_feat & ~server_feat) { - pr_err("msgr2 feature set mismatch: my required > server's supported 0x%llx, need 0x%llx\n", - server_feat, req_feat & ~server_feat); + libceph_err("msgr2 feature set mismatch: my required > server's supported 0x%llx, need 0x%llx\n", + server_feat, req_feat & ~server_feat); con->error_msg = "missing required protocol features"; return -EINVAL; } if (server_req_feat & ~feat) { - pr_err("msgr2 feature set mismatch: server's required > my supported 0x%llx, missing 0x%llx\n", - feat, server_req_feat & ~feat); + libceph_err("msgr2 feature set mismatch: server's required > my supported 0x%llx, missing 0x%llx\n", + feat, server_req_feat & ~feat); con->error_msg = "missing required protocol features"; return -EINVAL; } @@ -2205,7 +2209,7 @@ static int process_banner_payload(struct ceph_connection *con) /* no reset_out_kvecs() as our banner may still be pending */ ret = prepare_hello(con); if (ret) { - pr_err("prepare_hello failed: %d\n", ret); + libceph_err("prepare_hello failed: %d\n", ret); return ret; } @@ -2214,7 +2218,7 @@ static int process_banner_payload(struct ceph_connection *con) return 0; bad: - pr_err("failed to decode banner payload\n"); + libceph_err("failed to decode banner payload\n"); return -EINVAL; } @@ -2233,7 +2237,7 @@ static int process_hello(struct ceph_connection *con, void *p, void *end) ceph_decode_8_safe(&p, end, entity_type, bad); ret = ceph_decode_entity_addr(&p, end, &addr_for_me); if (ret) { - pr_err("failed to decode addr_for_me: %d\n", ret); + libceph_err("failed to decode addr_for_me: %d\n", ret); return ret; } @@ -2241,8 +2245,8 @@ static int process_hello(struct ceph_connection *con, void *p, void *end) entity_type, ceph_pr_addr(&addr_for_me)); if (entity_type != con->peer_name.type) { - pr_err("bad peer type, want %d, got %d\n", - con->peer_name.type, entity_type); + libceph_err("bad peer type, want %d, got %d\n", + con->peer_name.type, entity_type); con->error_msg = "wrong peer at address"; return -EINVAL; } @@ -2273,7 +2277,7 @@ static int process_hello(struct ceph_connection *con, void *p, void *end) ret = prepare_auth_request(con); if (ret) { if (ret != -EAGAIN) - pr_err("prepare_auth_request failed: %d\n", ret); + libceph_err("prepare_auth_request failed: %d\n", ret); return ret; } @@ -2281,7 +2285,7 @@ static int process_hello(struct ceph_connection *con, void *p, void *end) return 0; bad: - pr_err("failed to decode hello\n"); + libceph_err("failed to decode hello\n"); return -EINVAL; } @@ -2306,7 +2310,7 @@ static int process_auth_bad_method(struct ceph_connection *con, ceph_decode_32_safe(&p, end, allowed_proto_cnt, bad); if (allowed_proto_cnt > ARRAY_SIZE(allowed_protos)) { - pr_err("allowed_protos too big %d\n", allowed_proto_cnt); + libceph_err("allowed_protos too big %d\n", allowed_proto_cnt); return -EINVAL; } for (i = 0; i < allowed_proto_cnt; i++) { @@ -2317,7 +2321,7 @@ static int process_auth_bad_method(struct ceph_connection *con, ceph_decode_32_safe(&p, end, allowed_mode_cnt, bad); if (allowed_mode_cnt > ARRAY_SIZE(allowed_modes)) { - pr_err("allowed_modes too big %d\n", allowed_mode_cnt); + libceph_err("allowed_modes too big %d\n", allowed_mode_cnt); return -EINVAL; } for (i = 0; i < allowed_mode_cnt; i++) { @@ -2343,7 +2347,7 @@ static int process_auth_bad_method(struct ceph_connection *con, return ret; bad: - pr_err("failed to decode auth_bad_method\n"); + libceph_err("failed to decode auth_bad_method\n"); return -EINVAL; } @@ -2366,15 +2370,18 @@ static int process_auth_reply_more(struct ceph_connection *con, reset_out_kvecs(con); ret = prepare_auth_request_more(con, p, payload_len); if (ret) { - if (ret != -EAGAIN) - pr_err("prepare_auth_request_more failed: %d\n", ret); + if (ret != -EAGAIN) { + libceph_err("prepare_auth_request_more failed: %d\n", + ret); + } + return ret; } return 0; bad: - pr_err("failed to decode auth_reply_more\n"); + libceph_err("failed to decode auth_reply_more\n"); return -EINVAL; } @@ -2433,7 +2440,7 @@ static int process_auth_done(struct ceph_connection *con, void *p, void *end) reset_out_kvecs(con); ret = prepare_auth_signature(con); if (ret) { - pr_err("prepare_auth_signature failed: %d\n", ret); + libceph_err("prepare_auth_signature failed: %d\n", ret); goto out; } @@ -2445,7 +2452,7 @@ static int process_auth_done(struct ceph_connection *con, void *p, void *end) return ret; bad: - pr_err("failed to decode auth_done\n"); + libceph_err("failed to decode auth_done\n"); return -EINVAL; } @@ -2477,7 +2484,7 @@ static int process_auth_signature(struct ceph_connection *con, if (!con->v2.server_cookie) { ret = prepare_client_ident(con); if (ret) { - pr_err("prepare_client_ident failed: %d\n", ret); + libceph_err("prepare_client_ident failed: %d\n", ret); return ret; } @@ -2485,7 +2492,8 @@ static int process_auth_signature(struct ceph_connection *con, } else { ret = prepare_session_reconnect(con); if (ret) { - pr_err("prepare_session_reconnect failed: %d\n", ret); + libceph_err("prepare_session_reconnect failed: %d\n", + ret); return ret; } @@ -2495,7 +2503,7 @@ static int process_auth_signature(struct ceph_connection *con, return 0; bad: - pr_err("failed to decode auth_signature\n"); + libceph_err("failed to decode auth_signature\n"); return -EINVAL; } @@ -2518,7 +2526,7 @@ static int process_server_ident(struct ceph_connection *con, ret = ceph_decode_entity_addrvec(&p, end, true, &addr); if (ret) { - pr_err("failed to decode server addrs: %d\n", ret); + libceph_err("failed to decode server addrs: %d\n", ret); return ret; } @@ -2535,17 +2543,17 @@ static int process_server_ident(struct ceph_connection *con, /* is this who we intended to talk to? */ if (memcmp(&addr, &con->peer_addr, sizeof(con->peer_addr))) { - pr_err("bad peer addr/nonce, want %s/%u, got %s/%u\n", - ceph_pr_addr(&con->peer_addr), - le32_to_cpu(con->peer_addr.nonce), - ceph_pr_addr(&addr), le32_to_cpu(addr.nonce)); + libceph_err("bad peer addr/nonce, want %s/%u, got %s/%u\n", + ceph_pr_addr(&con->peer_addr), + le32_to_cpu(con->peer_addr.nonce), + ceph_pr_addr(&addr), le32_to_cpu(addr.nonce)); con->error_msg = "wrong peer at address"; return -EINVAL; } if (client->required_features & ~features) { - pr_err("RADOS feature set mismatch: my required > server's supported 0x%llx, need 0x%llx\n", - features, client->required_features & ~features); + libceph_err("RADOS feature set mismatch: my required > server's supported 0x%llx, need 0x%llx\n", + features, client->required_features & ~features); con->error_msg = "missing required protocol features"; return -EINVAL; } @@ -2579,7 +2587,7 @@ static int process_server_ident(struct ceph_connection *con, return 0; bad: - pr_err("failed to decode server_ident\n"); + libceph_err("failed to decode server_ident\n"); return -EINVAL; } @@ -2595,13 +2603,13 @@ static int process_ident_missing_features(struct ceph_connection *con, } ceph_decode_64_safe(&p, end, missing_features, bad); - pr_err("RADOS feature set mismatch: server's required > my supported 0x%llx, missing 0x%llx\n", - client->supported_features, missing_features); + libceph_err("RADOS feature set mismatch: server's required > my supported 0x%llx, missing 0x%llx\n", + client->supported_features, missing_features); con->error_msg = "missing required protocol features"; return -EINVAL; bad: - pr_err("failed to decode ident_missing_features\n"); + libceph_err("failed to decode ident_missing_features\n"); return -EINVAL; } @@ -2630,7 +2638,7 @@ static int process_session_reconnect_ok(struct ceph_connection *con, return 0; bad: - pr_err("failed to decode session_reconnect_ok\n"); + libceph_err("failed to decode session_reconnect_ok\n"); return -EINVAL; } @@ -2656,14 +2664,15 @@ static int process_session_retry(struct ceph_connection *con, reset_out_kvecs(con); ret = prepare_session_reconnect(con); if (ret) { - pr_err("prepare_session_reconnect (cseq) failed: %d\n", ret); + libceph_err("prepare_session_reconnect (cseq) failed: %d\n", + ret); return ret; } return 0; bad: - pr_err("failed to decode session_retry\n"); + libceph_err("failed to decode session_retry\n"); return -EINVAL; } @@ -2689,14 +2698,15 @@ static int process_session_retry_global(struct ceph_connection *con, reset_out_kvecs(con); ret = prepare_session_reconnect(con); if (ret) { - pr_err("prepare_session_reconnect (gseq) failed: %d\n", ret); + libceph_err("prepare_session_reconnect (gseq) failed: %d\n", + ret); return ret; } return 0; bad: - pr_err("failed to decode session_retry_global\n"); + libceph_err("failed to decode session_retry_global\n"); return -EINVAL; } @@ -2717,8 +2727,9 @@ static int process_session_reset(struct ceph_connection *con, return -EINVAL; } - pr_info("%s%lld %s session reset\n", ENTITY_NAME(con- >peer_name), - ceph_pr_addr(&con->peer_addr)); + libceph_info("%s%lld %s session reset\n", + ENTITY_NAME(con->peer_name), + ceph_pr_addr(&con->peer_addr)); ceph_con_reset_session(con); mutex_unlock(&con->mutex); @@ -2736,7 +2747,7 @@ static int process_session_reset(struct ceph_connection *con, reset_out_kvecs(con); ret = prepare_client_ident(con); if (ret) { - pr_err("prepare_client_ident (rst) failed: %d\n", ret); + libceph_err("prepare_client_ident (rst) failed: %d\n", ret); return ret; } @@ -2744,7 +2755,7 @@ static int process_session_reset(struct ceph_connection *con, return 0; bad: - pr_err("failed to decode session_reset\n"); + libceph_err("failed to decode session_reset\n"); return -EINVAL; } @@ -2765,7 +2776,7 @@ static int process_keepalive2_ack(struct ceph_connection *con, return 0; bad: - pr_err("failed to decode keepalive2_ack\n"); + libceph_err("failed to decode keepalive2_ack\n"); return -EINVAL; } @@ -2785,7 +2796,7 @@ static int process_ack(struct ceph_connection *con, void *p, void *end) return 0; bad: - pr_err("failed to decode ack\n"); + libceph_err("failed to decode ack\n"); return -EINVAL; } @@ -2837,7 +2848,7 @@ static int process_control(struct ceph_connection *con, void *p, void *end) ret = process_ack(con, p, end); break; default: - pr_err("bad tag %d\n", tag); + libceph_err("bad tag %d\n", tag); con->error_msg = "protocol error, bad tag"; return -EINVAL; } @@ -2869,14 +2880,15 @@ static int process_message_header(struct ceph_connection *con, /* verify seq# */ seq = le64_to_cpu(hdr2->seq); if ((s64)seq - (s64)con->in_seq < 1) { - pr_info("%s%lld %s skipping old message: seq %llu, expected %llu\n", - ENTITY_NAME(con->peer_name), - ceph_pr_addr(&con->peer_addr), - seq, con->in_seq + 1); + libceph_info("%s%lld %s skipping old message: seq %llu, expected %llu\n", + ENTITY_NAME(con->peer_name), + ceph_pr_addr(&con->peer_addr), + seq, con->in_seq + 1); return 0; } if ((s64)seq - (s64)con->in_seq > 1) { - pr_err("bad seq %llu, expected %llu\n", seq, con- >in_seq + 1); + libceph_err("bad seq %llu, expected %llu\n", + seq, con->in_seq + 1); con->error_msg = "bad message sequence # for incoming message"; return -EBADE; } @@ -3336,20 +3348,20 @@ static int populate_out_iter(struct ceph_connection *con) if (ceph_con_flag_test_and_clear(con, CEPH_CON_F_KEEPALIVE_PENDING)) { ret = prepare_keepalive2(con); if (ret) { - pr_err("prepare_keepalive2 failed: %d\n", ret); + libceph_err("prepare_keepalive2 failed: %d\n", ret); return ret; } } else if (!list_empty(&con->out_queue)) { ceph_con_get_out_msg(con); ret = prepare_message(con); if (ret) { - pr_err("prepare_message failed: %d\n", ret); + libceph_err("prepare_message failed: %d\n", ret); return ret; } } else if (con->in_seq > con->in_seq_acked) { ret = prepare_ack(con); if (ret) { - pr_err("prepare_ack failed: %d\n", ret); + libceph_err("prepare_ack failed: %d\n", ret); return ret; } } else { @@ -3392,7 +3404,8 @@ int ceph_con_v2_try_write(struct ceph_connection *con) ret = prepare_read_banner_prefix(con); if (ret) { - pr_err("prepare_read_banner_prefix failed: %d\n", ret); + libceph_err("prepare_read_banner_prefix failed: %d\n", + ret); con->error_msg = "connect error"; return ret; } @@ -3400,14 +3413,14 @@ int ceph_con_v2_try_write(struct ceph_connection *con) reset_out_kvecs(con); ret = prepare_banner(con); if (ret) { - pr_err("prepare_banner failed: %d\n", ret); + libceph_err("prepare_banner failed: %d\n", ret); con->error_msg = "connect error"; return ret; } ret = ceph_tcp_connect(con); if (ret) { - pr_err("ceph_tcp_connect failed: %d\n", ret); + libceph_err("ceph_tcp_connect failed: %d\n", ret); con->error_msg = "connect error"; return ret; } diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index ab66b599ac47..70e89124e92a 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c @@ -278,9 +278,11 @@ static void __open_session(struct ceph_mon_client *monc) static void reopen_session(struct ceph_mon_client *monc) { - if (!monc->hunting) - pr_info("mon%d %s session lost, hunting for new mon\n", - monc->cur_mon, ceph_pr_addr(&monc- >con.peer_addr)); + if (!monc->hunting) { + libceph_info("mon%d %s session lost, hunting for new mon\n", + monc->cur_mon, + ceph_pr_addr(&monc->con.peer_addr)); + } __close_session(monc); __open_session(monc); @@ -407,7 +409,7 @@ static void handle_subscribe_ack(struct ceph_mon_client *monc, mutex_unlock(&monc->mutex); return; bad: - pr_err("got corrupt subscribe-ack msg\n"); + libceph_err("got corrupt subscribe-ack msg\n"); ceph_msg_dump(msg); } @@ -551,8 +553,8 @@ static void ceph_monc_handle_map(struct ceph_mon_client *monc, monmap = ceph_monmap_decode(&p, end, ceph_msgr2(client)); if (IS_ERR(monmap)) { - pr_err("problem decoding monmap, %d\n", - (int)PTR_ERR(monmap)); + libceph_err("problem decoding monmap, %d\n", + (int)PTR_ERR(monmap)); ceph_msg_dump(msg); goto out; } @@ -763,7 +765,7 @@ static void handle_statfs_reply(struct ceph_mon_client *monc, return; bad: - pr_err("corrupt statfs reply, tid %llu\n", tid); + libceph_err("corrupt statfs reply, tid %llu\n", tid); ceph_msg_dump(msg); } @@ -845,7 +847,7 @@ static void handle_get_version_reply(struct ceph_mon_client *monc, return; bad: - pr_err("corrupt mon_get_version reply, tid %llu\n", tid); + libceph_err("corrupt mon_get_version reply, tid %llu\n", tid); ceph_msg_dump(msg); } @@ -965,7 +967,7 @@ static void handle_command_ack(struct ceph_mon_client *monc, return; bad: - pr_err("corrupt mon_command ack, tid %llu\n", tid); + libceph_err("corrupt mon_command ack, tid %llu\n", tid); ceph_msg_dump(msg); } @@ -1305,8 +1307,9 @@ static void finish_auth(struct ceph_mon_client *monc, int auth_err, __send_subscribe(monc); __resend_generic_request(monc); - pr_info("mon%d %s session established\n", monc- >cur_mon, - ceph_pr_addr(&monc->con.peer_addr)); + libceph_info("mon%d %s session established\n", + monc->cur_mon, + ceph_pr_addr(&monc->con.peer_addr)); } } @@ -1482,8 +1485,8 @@ static void mon_dispatch(struct ceph_connection *con, struct ceph_msg *msg) monc->client->extra_mon_dispatch(monc->client, msg) == 0) break; - pr_err("received unknown message type %d %s\n", type, - ceph_msg_type_name(type)); + libceph_err("received unknown message type %d %s\n", type, + ceph_msg_type_name(type)); } ceph_msg_put(msg); } @@ -1533,13 +1536,13 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con, } if (!m) { - pr_info("alloc_msg unknown type %d\n", type); + libceph_info("alloc_msg unknown type %d\n", type); *skip = 1; } else if (front_len > m->front_alloc_len) { - pr_warn("mon_alloc_msg front %d > prealloc %d (%u#%llu)\n", - front_len, m->front_alloc_len, - (unsigned int)con->peer_name.type, - le64_to_cpu(con->peer_name.num)); + libceph_warn("mon_alloc_msg front %d > prealloc %d (%u#%llu)\n", + front_len, m->front_alloc_len, + (unsigned int)con->peer_name.type, + le64_to_cpu(con->peer_name.num)); ceph_msg_put(m); m = ceph_msg_new(type, front_len, GFP_NOFS, false); } diff --git a/net/ceph/msgpool.c b/net/ceph/msgpool.c index e3ecb80cd182..70989edc5ee8 100644 --- a/net/ceph/msgpool.c +++ b/net/ceph/msgpool.c @@ -63,9 +63,10 @@ struct ceph_msg *ceph_msgpool_get(struct ceph_msgpool *pool, int front_len, if (front_len > pool->front_len || max_data_items > pool->max_data_items) { - pr_warn_ratelimited("%s need %d/%d, pool %s has %d/%d\n", - __func__, front_len, max_data_items, pool->name, - pool->front_len, pool->max_data_items); + libceph_warn("%s need %d/%d, pool %s has %d/%d\n", + __func__, front_len, max_data_items, + pool->name, pool->front_len, + pool->max_data_items); WARN_ON_ONCE(1); /* try to alloc a fresh message */ diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index b24afec24138..b241607281c0 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -1053,8 +1053,8 @@ static u32 osd_req_encode_op(struct ceph_osd_op *dst, dst->assert_ver.ver = cpu_to_le64(src- >assert_ver.ver); break; default: - pr_err("unsupported osd opcode %s\n", - ceph_osd_op_name(src->op)); + libceph_err("unsupported osd opcode %s\n", + ceph_osd_op_name(src->op)); WARN_ON(1); return 0; @@ -1858,7 +1858,7 @@ static int decode_hoid(void **p, void *end, struct ceph_hobject_id *hoid) return ret; if (struct_v < 4) { - pr_err("got struct_v %d < 4 of hobject_t\n", struct_v); + libceph_err("got struct_v %d < 4 of hobject_t\n", struct_v); goto e_inval; } @@ -2448,10 +2448,10 @@ static void __submit_request(struct ceph_osd_request *req, bool wrlocked) err = -ENOSPC; } else { if (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL)) - pr_warn_ratelimited("cluster is full (osdmap FULL)\n"); + libceph_warn("cluster is full (osdmap FULL)\n"); else - pr_warn_ratelimited("pool %lld is full or reached quota\n", - req- >r_t.base_oloc.pool); + libceph_warn("pool %lld is full or reached quota\n", + req->r_t.base_oloc.pool); req->r_t.paused = true; maybe_request_map(osdc); } @@ -2721,8 +2721,8 @@ static void check_pool_dne(struct ceph_osd_request *req) if (req->r_map_dne_bound) { if (map->epoch >= req->r_map_dne_bound) { /* we had a new enough map */ - pr_info_ratelimited("tid %llu pool does not exist\n", - req->r_tid); + libceph_info("tid %llu pool does not exist\n", + req->r_tid); complete_request(req, -ENOENT); } } else { @@ -3048,7 +3048,7 @@ static void queue_watch_error(struct ceph_osd_linger_request *lreq) lwork = lwork_alloc(lreq, do_watch_error); if (!lwork) { - pr_err("failed to allocate error-lwork\n"); + libceph_err("failed to allocate error-lwork\n"); return; } @@ -3354,8 +3354,8 @@ static void check_linger_pool_dne(struct ceph_osd_linger_request *lreq) if (lreq->map_dne_bound) { if (map->epoch >= lreq->map_dne_bound) { /* we had a new enough map */ - pr_info("linger_id %llu pool does not exist\n", - lreq->linger_id); + libceph_info("linger_id %llu pool does not exist\n", + lreq->linger_id); linger_reg_commit_complete(lreq, -ENOENT); __linger_cancel(lreq); } @@ -3480,8 +3480,8 @@ static void handle_timeout(struct work_struct *work) } if (opts->osd_request_timeout && time_before(req->r_start_stamp, expiry_cutoff)) { - pr_err_ratelimited("tid %llu on osd%d timeout\n", - req->r_tid, osd->o_osd); + libceph_err("tid %llu on osd%d timeout\n", + req->r_tid, osd->o_osd); abort_request(req, -ETIMEDOUT); } } @@ -3511,8 +3511,9 @@ static void handle_timeout(struct work_struct *work) p = rb_next(p); /* abort_request() */ if (time_before(req->r_start_stamp, expiry_cutoff)) { - pr_err_ratelimited("tid %llu on osd%d timeout\n", - req->r_tid, osdc- >homeless_osd.o_osd); + libceph_err("tid %llu on osd%d timeout\n", + req->r_tid, + osdc->homeless_osd.o_osd); abort_request(req, -ETIMEDOUT); } } @@ -3570,13 +3571,13 @@ static int ceph_oloc_decode(void **p, void *end, struct_v = ceph_decode_8(p); struct_cv = ceph_decode_8(p); if (struct_v < 3) { - pr_warn("got v %d < 3 cv %d of ceph_object_locator\n", - struct_v, struct_cv); + libceph_warn("got v %d < 3 cv %d of ceph_object_locator\n", + struct_v, struct_cv); goto e_inval; } if (struct_cv > 6) { - pr_warn("got v %d cv %d > 6 of ceph_object_locator\n", - struct_v, struct_cv); + libceph_warn("got v %d cv %d > 6 of ceph_object_locator\n", + struct_v, struct_cv); goto e_inval; } len = ceph_decode_32(p); @@ -3588,7 +3589,7 @@ static int ceph_oloc_decode(void **p, void *end, len = ceph_decode_32(p); if (len > 0) { - pr_warn("ceph_object_locator::key is set\n"); + libceph_warn("ceph_object_locator::key is set\n"); goto e_inval; } @@ -3608,7 +3609,7 @@ static int ceph_oloc_decode(void **p, void *end, } if (changed) { /* redirect changes namespace */ - pr_warn("ceph_object_locator::nspace is changed\n"); + libceph_warn("ceph_object_locator::nspace is changed\n"); goto e_inval; } } @@ -3616,7 +3617,7 @@ static int ceph_oloc_decode(void **p, void *end, if (struct_v >= 6) { s64 hash = ceph_decode_64(p); if (hash != -1) { - pr_warn("ceph_object_locator::hash is set\n"); + libceph_warn("ceph_object_locator::hash is set\n"); goto e_inval; } } @@ -3643,8 +3644,8 @@ static int ceph_redirect_decode(void **p, void *end, struct_v = ceph_decode_8(p); struct_cv = ceph_decode_8(p); if (struct_cv > 1) { - pr_warn("got v %d cv %d > 1 of ceph_request_redirect\n", - struct_v, struct_cv); + libceph_warn("got v %d cv %d > 1 of ceph_request_redirect\n", + struct_v, struct_cv); goto e_inval; } len = ceph_decode_32(p); @@ -3657,7 +3658,7 @@ static int ceph_redirect_decode(void **p, void *end, len = ceph_decode_32(p); if (len > 0) { - pr_warn("ceph_request_redirect::object_name is set\n"); + libceph_warn("ceph_request_redirect::object_name is set\n"); goto e_inval; } @@ -3795,8 +3796,8 @@ static void handle_reply(struct ceph_osd *osd, struct ceph_msg *msg) ret = decode_MOSDOpReply(msg, &m); m.redirect.oloc.pool_ns = NULL; if (ret) { - pr_err("failed to decode MOSDOpReply for tid %llu: %d\n", - req->r_tid, ret); + libceph_err("failed to decode MOSDOpReply for tid %llu: %d\n", + req->r_tid, ret); ceph_msg_dump(msg); goto fail_request; } @@ -3856,8 +3857,8 @@ static void handle_reply(struct ceph_osd *osd, struct ceph_msg *msg) } if (m.num_ops != req->r_num_ops) { - pr_err("num_ops %d != %d for tid %llu\n", m.num_ops, - req->r_num_ops, req->r_tid); + libceph_err("num_ops %d != %d for tid %llu\n", m.num_ops, + req->r_num_ops, req->r_tid); goto fail_request; } for (i = 0; i < req->r_num_ops; i++) { @@ -3868,8 +3869,8 @@ static void handle_reply(struct ceph_osd *osd, struct ceph_msg *msg) data_len += m.outdata_len[i]; } if (data_len != le32_to_cpu(msg->hdr.data_len)) { - pr_err("sum of lens %u != %u for tid %llu\n", data_len, - le32_to_cpu(msg->hdr.data_len), req->r_tid); + libceph_err("sum of lens %u != %u for tid %llu\n", data_len, + le32_to_cpu(msg->hdr.data_len), req- >r_tid); goto fail_request; } dout("%s req %p tid %llu result %d data_len %u\n", __func__, @@ -4255,7 +4256,7 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg) return; bad: - pr_err("osdc handle_map corrupt msg\n"); + libceph_err("osdc handle_map corrupt msg\n"); ceph_msg_dump(msg); up_write(&osdc->lock); } @@ -4424,7 +4425,7 @@ static void handle_backoff_block(struct ceph_osd *osd, struct MOSDBackoff *m) if (!spg) { spg = alloc_spg_mapping(); if (!spg) { - pr_err("%s failed to allocate spg\n", __func__); + libceph_err("%s failed to allocate spg\n", __func__); return; } spg->spgid = m->spgid; /* struct */ @@ -4433,7 +4434,7 @@ static void handle_backoff_block(struct ceph_osd *osd, struct MOSDBackoff *m) backoff = alloc_backoff(); if (!backoff) { - pr_err("%s failed to allocate backoff\n", __func__); + libceph_err("%s failed to allocate backoff\n", __func__); return; } backoff->spgid = m->spgid; /* struct */ @@ -4452,7 +4453,7 @@ static void handle_backoff_block(struct ceph_osd *osd, struct MOSDBackoff *m) */ msg = create_backoff_message(backoff, m->map_epoch); if (!msg) { - pr_err("%s failed to allocate msg\n", __func__); + libceph_err("%s failed to allocate msg\n", __func__); return; } ceph_con_send(&osd->o_con, msg); @@ -4482,17 +4483,17 @@ static void handle_backoff_unblock(struct ceph_osd *osd, backoff = lookup_backoff_by_id(&osd->o_backoffs_by_id, m->id); if (!backoff) { - pr_err("%s osd%d spgid %llu.%xs%d id %llu backoff dne\n", - __func__, osd->o_osd, m->spgid.pgid.pool, - m->spgid.pgid.seed, m->spgid.shard, m->id); + libceph_err("%s osd%d spgid %llu.%xs%d id %llu backoff dne\n", + __func__, osd->o_osd, m->spgid.pgid.pool, + m->spgid.pgid.seed, m->spgid.shard, m- >id); return; } if (hoid_compare(backoff->begin, m->begin) && hoid_compare(backoff->end, m->end)) { - pr_err("%s osd%d spgid %llu.%xs%d id %llu bad range?\n", - __func__, osd->o_osd, m->spgid.pgid.pool, - m->spgid.pgid.seed, m->spgid.shard, m->id); + libceph_err("%s osd%d spgid %llu.%xs%d id %llu bad range?\n", + __func__, osd->o_osd, m->spgid.pgid.pool, + m->spgid.pgid.seed, m->spgid.shard, m- >id); /* unblock it anyway... */ } @@ -4545,7 +4546,7 @@ static void handle_backoff(struct ceph_osd *osd, struct ceph_msg *msg) mutex_lock(&osd->lock); ret = decode_MOSDBackoff(msg, &m); if (ret) { - pr_err("failed to decode MOSDBackoff: %d\n", ret); + libceph_err("failed to decode MOSDBackoff: %d\n", ret); ceph_msg_dump(msg); goto out_unlock; } @@ -4558,7 +4559,8 @@ static void handle_backoff(struct ceph_osd *osd, struct ceph_msg *msg) handle_backoff_unblock(osd, &m); break; default: - pr_err("%s osd%d unknown op %d\n", __func__, osd- >o_osd, m.op); + libceph_err("%s osd%d unknown op %d\n", + __func__, osd->o_osd, m.op); } free_hoid(m.begin); @@ -4646,7 +4648,7 @@ static void handle_watch_notify(struct ceph_osd_client *osdc, /* CEPH_WATCH_EVENT_NOTIFY */ lwork = lwork_alloc(lreq, do_watch_notify); if (!lwork) { - pr_err("failed to allocate notify-lwork\n"); + libceph_err("failed to allocate notify- lwork\n"); goto out_unlock_lreq; } @@ -4665,7 +4667,7 @@ static void handle_watch_notify(struct ceph_osd_client *osdc, return; bad: - pr_err("osdc handle_watch_notify corrupt msg\n"); + libceph_err("osdc handle_watch_notify corrupt msg\n"); } /* @@ -5393,8 +5395,8 @@ static void osd_dispatch(struct ceph_connection *con, struct ceph_msg *msg) break; default: - pr_err("received unknown message type %d %s\n", type, - ceph_msg_type_name(type)); + libceph_err("received unknown message type %d %s\n", type, + ceph_msg_type_name(type)); } ceph_msg_put(msg); @@ -5456,9 +5458,9 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, ceph_msg_revoke_incoming(req->r_reply); if (front_len > req->r_reply->front_alloc_len) { - pr_warn("%s osd%d tid %llu front %d > preallocated %d\n", - __func__, osd->o_osd, req->r_tid, front_len, - req->r_reply->front_alloc_len); + libceph_warn("%s osd%d tid %llu front %d > preallocated %d\n", + __func__, osd->o_osd, req->r_tid, front_len, + req->r_reply->front_alloc_len); m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front_len, GFP_NOFS, false); if (!m) @@ -5469,9 +5471,9 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, srlen = sparse_data_requested(req); if (!srlen && data_len > req->r_reply->data_length) { - pr_warn("%s osd%d tid %llu data %d > preallocated %zu, skipping\n", - __func__, osd->o_osd, req->r_tid, data_len, - req->r_reply->data_length); + libceph_warn("%s osd%d tid %llu data %d > preallocated %zu, skipping\n", + __func__, osd->o_osd, req->r_tid, data_len, + req->r_reply->data_length); m = NULL; *skip = 1; goto out_unlock_session; @@ -5532,8 +5534,8 @@ static struct ceph_msg *osd_alloc_msg(struct ceph_connection *con, case CEPH_MSG_OSD_OPREPLY: return get_reply(con, hdr, skip); default: - pr_warn("%s osd%d unknown msg type %d, skipping\n", __func__, - osd->o_osd, type); + libceph_warn("%s osd%d unknown msg type %d, skipping\n", __func__, + osd->o_osd, type); *skip = 1; return NULL; } @@ -5851,8 +5853,8 @@ static int osd_sparse_read(struct ceph_connection *con, sizeof(*sr->sr_extent), GFP_NOIO); if (!sr->sr_extent) { - pr_err("%s: failed to allocate %u extents\n", - __func__, count); + libceph_err("%s: failed to allocate %u extents\n", + __func__, count); return -ENOMEM; } sr->sr_ext_len = count; @@ -5876,8 +5878,8 @@ static int osd_sparse_read(struct ceph_connection *con, for (i = 0; i < count; i++) len += sr->sr_extent[i].len; if (sr->sr_datalen != len) { - pr_warn_ratelimited("data len %u != extent len %llu\n", - sr->sr_datalen, len); + libceph_warn("data len %u != extent len %llu\n", + sr->sr_datalen, len); return -EREMOTEIO; } sr->sr_state = CEPH_SPARSE_READ_DATA; diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 295098873861..6ca65e5b4a49 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -456,8 +456,8 @@ static struct crush_map *crush_decode(void *pbyval, void *end) ceph_decode_need(p, end, 4*sizeof(u32), bad); magic = ceph_decode_32(p); if (magic != CRUSH_MAGIC) { - pr_err("crush_decode magic %x != current %x\n", - (unsigned int)magic, (unsigned int)CRUSH_MAGIC); + libceph_err("crush_decode magic %x != current %x\n", + (unsigned int)magic, (unsigned int)CRUSH_MAGIC);