Skip to content

Commit 70d85be

Browse files
ssingh-ionosaxboe
authored andcommitted
block/rnbd: use %pe to print errors
While printing error, replace %ld by %pe. %pe prints a string whereas %ld would print an error code. Signed-off-by: Supriti Singh <supriti.singh@ionos.com> Signed-off-by: Jack Wang <jinpu.wang@ionos.com> Signed-off-by: Grzegorz Prajsner <grzegorz.prajsner@ionos.com> Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com> Link: https://lore.kernel.org/r/20231124213422.113449-3-haris.iqbal@ionos.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent fadf3df commit 70d85be

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

drivers/block/rnbd/rnbd-clt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,8 +1569,8 @@ struct rnbd_clt_dev *rnbd_clt_map_device(const char *sessname,
15691569

15701570
dev = init_dev(sess, access_mode, pathname, nr_poll_queues);
15711571
if (IS_ERR(dev)) {
1572-
pr_err("map_device: failed to map device '%s' from session %s, can't initialize device, err: %ld\n",
1573-
pathname, sess->sessname, PTR_ERR(dev));
1572+
pr_err("map_device: failed to map device '%s' from session %s, can't initialize device, err: %pe\n",
1573+
pathname, sess->sessname, dev);
15741574
ret = PTR_ERR(dev);
15751575
goto put_sess;
15761576
}

drivers/block/rnbd/rnbd-srv.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ static int process_rdma(struct rnbd_srv_session *srv_sess,
136136

137137
sess_dev = rnbd_get_sess_dev(dev_id, srv_sess);
138138
if (IS_ERR(sess_dev)) {
139-
pr_err_ratelimited("Got I/O request on session %s for unknown device id %d\n",
140-
srv_sess->sessname, dev_id);
139+
pr_err_ratelimited("Got I/O request on session %s for unknown device id %d: %pe\n",
140+
srv_sess->sessname, dev_id, sess_dev);
141141
err = -ENOTCONN;
142142
goto err;
143143
}
@@ -710,24 +710,24 @@ static int process_msg_open(struct rnbd_srv_session *srv_sess,
710710
full_path = rnbd_srv_get_full_path(srv_sess, open_msg->dev_name);
711711
if (IS_ERR(full_path)) {
712712
ret = PTR_ERR(full_path);
713-
pr_err("Opening device '%s' for client %s failed, failed to get device full path, err: %d\n",
714-
open_msg->dev_name, srv_sess->sessname, ret);
713+
pr_err("Opening device '%s' for client %s failed, failed to get device full path, err: %pe\n",
714+
open_msg->dev_name, srv_sess->sessname, full_path);
715715
goto reject;
716716
}
717717

718718
bdev_handle = bdev_open_by_path(full_path, open_flags, NULL, NULL);
719719
if (IS_ERR(bdev_handle)) {
720720
ret = PTR_ERR(bdev_handle);
721-
pr_err("Opening device '%s' on session %s failed, failed to open the block device, err: %d\n",
722-
full_path, srv_sess->sessname, ret);
721+
pr_err("Opening device '%s' on session %s failed, failed to open the block device, err: %pe\n",
722+
full_path, srv_sess->sessname, bdev_handle);
723723
goto free_path;
724724
}
725725

726726
srv_dev = rnbd_srv_get_or_create_srv_dev(bdev_handle->bdev, srv_sess,
727727
open_msg->access_mode);
728728
if (IS_ERR(srv_dev)) {
729-
pr_err("Opening device '%s' on session %s failed, creating srv_dev failed, err: %ld\n",
730-
full_path, srv_sess->sessname, PTR_ERR(srv_dev));
729+
pr_err("Opening device '%s' on session %s failed, creating srv_dev failed, err: %pe\n",
730+
full_path, srv_sess->sessname, srv_dev);
731731
ret = PTR_ERR(srv_dev);
732732
goto blkdev_put;
733733
}
@@ -737,8 +737,8 @@ static int process_msg_open(struct rnbd_srv_session *srv_sess,
737737
open_msg->access_mode == RNBD_ACCESS_RO,
738738
srv_dev);
739739
if (IS_ERR(srv_sess_dev)) {
740-
pr_err("Opening device '%s' on session %s failed, creating sess_dev failed, err: %ld\n",
741-
full_path, srv_sess->sessname, PTR_ERR(srv_sess_dev));
740+
pr_err("Opening device '%s' on session %s failed, creating sess_dev failed, err: %pe\n",
741+
full_path, srv_sess->sessname, srv_sess_dev);
742742
ret = PTR_ERR(srv_sess_dev);
743743
goto srv_dev_put;
744744
}
@@ -819,7 +819,7 @@ static int __init rnbd_srv_init_module(void)
819819
};
820820
rtrs_ctx = rtrs_srv_open(&rtrs_ops, port_nr);
821821
if (IS_ERR(rtrs_ctx)) {
822-
pr_err("rtrs_srv_open(), err: %d\n", err);
822+
pr_err("rtrs_srv_open(), err: %pe\n", rtrs_ctx);
823823
return PTR_ERR(rtrs_ctx);
824824
}
825825

0 commit comments

Comments
 (0)