lkml.org 
[lkml]   [2017]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] rbd: add timeout function to rbd driver
Hi Xiongwei,

[auto build test WARNING on ceph-client/for-linus]
[also build test WARNING on v4.13-rc2 next-20170727]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/xiongweijiang666-gmail-com/rbd-add-timeout-function-to-rbd-driver/20170728-085544
base: https://github.com/ceph/ceph-client.git for-linus
config: i386-randconfig-x071-201730 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

drivers/block/rbd.c: In function 'rbd_queue_workfn':
>> drivers/block/rbd.c:4135:22: warning: 'linker' may be used uninitialized in this function [-Wmaybe-uninitialized]
linker->img_request = img_request;
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

vim +/linker +4135 drivers/block/rbd.c

4021
4022 static void rbd_queue_workfn(struct work_struct *work)
4023 {
4024 struct request *rq = blk_mq_rq_from_pdu(work);
4025 struct rbd_device *rbd_dev = rq->q->queuedata;
4026 struct rbd_img_request *img_request;
4027 struct rbd_request_linker *linker;
4028 struct ceph_snap_context *snapc = NULL;
4029 u64 offset = (u64)blk_rq_pos(rq) << SECTOR_SHIFT;
4030 u64 length = blk_rq_bytes(rq);
4031 enum obj_operation_type op_type;
4032 u64 mapping_size;
4033 bool must_be_locked;
4034 int result;
4035
4036 switch (req_op(rq)) {
4037 case REQ_OP_DISCARD:
4038 case REQ_OP_WRITE_ZEROES:
4039 op_type = OBJ_OP_DISCARD;
4040 break;
4041 case REQ_OP_WRITE:
4042 op_type = OBJ_OP_WRITE;
4043 break;
4044 case REQ_OP_READ:
4045 op_type = OBJ_OP_READ;
4046 break;
4047 default:
4048 dout("%s: non-fs request type %d\n", __func__, req_op(rq));
4049 result = -EIO;
4050 goto err;
4051 }
4052
4053 /* Ignore/skip any zero-length requests */
4054
4055 if (!length) {
4056 dout("%s: zero-length request\n", __func__);
4057 result = 0;
4058 goto err_rq;
4059 }
4060
4061 /* Only reads are allowed to a read-only device */
4062
4063 if (op_type != OBJ_OP_READ) {
4064 if (rbd_dev->mapping.read_only) {
4065 result = -EROFS;
4066 goto err_rq;
4067 }
4068 rbd_assert(rbd_dev->spec->snap_id == CEPH_NOSNAP);
4069 }
4070
4071 /*
4072 * Quit early if the mapped snapshot no longer exists. It's
4073 * still possible the snapshot will have disappeared by the
4074 * time our request arrives at the osd, but there's no sense in
4075 * sending it if we already know.
4076 */
4077 if (!test_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags)) {
4078 dout("request for non-existent snapshot");
4079 rbd_assert(rbd_dev->spec->snap_id != CEPH_NOSNAP);
4080 result = -ENXIO;
4081 goto err_rq;
4082 }
4083
4084 if (offset && length > U64_MAX - offset + 1) {
4085 rbd_warn(rbd_dev, "bad request range (%llu~%llu)", offset,
4086 length);
4087 result = -EINVAL;
4088 goto err_rq; /* Shouldn't happen */
4089 }
4090
4091 blk_mq_start_request(rq);
4092
4093 down_read(&rbd_dev->header_rwsem);
4094 mapping_size = rbd_dev->mapping.size;
4095 if (op_type != OBJ_OP_READ) {
4096 snapc = rbd_dev->header.snapc;
4097 ceph_get_snap_context(snapc);
4098 }
4099 up_read(&rbd_dev->header_rwsem);
4100
4101 if (offset + length > mapping_size) {
4102 rbd_warn(rbd_dev, "beyond EOD (%llu~%llu > %llu)", offset,
4103 length, mapping_size);
4104 result = -EIO;
4105 goto err_rq;
4106 }
4107
4108 must_be_locked =
4109 (rbd_dev->header.features & RBD_FEATURE_EXCLUSIVE_LOCK) &&
4110 (op_type != OBJ_OP_READ || rbd_dev->opts->lock_on_read);
4111 if (must_be_locked) {
4112 down_read(&rbd_dev->lock_rwsem);
4113 if (rbd_dev->lock_state != RBD_LOCK_STATE_LOCKED &&
4114 !test_bit(RBD_DEV_FLAG_BLACKLISTED, &rbd_dev->flags)) {
4115 if (rbd_dev->opts->exclusive) {
4116 rbd_warn(rbd_dev, "exclusive lock required");
4117 result = -EROFS;
4118 goto err_unlock;
4119 }
4120 rbd_wait_state_locked(rbd_dev);
4121 }
4122 if (test_bit(RBD_DEV_FLAG_BLACKLISTED, &rbd_dev->flags)) {
4123 result = -EBLACKLISTED;
4124 goto err_unlock;
4125 }
4126 }
4127
4128 img_request = rbd_img_request_create(rbd_dev, offset, length, op_type,
4129 snapc);
4130 if (!img_request) {
4131 result = -ENOMEM;
4132 goto err_unlock;
4133 }
4134 img_request->rq = rq;
> 4135 linker->img_request = img_request;
4136 snapc = NULL; /* img_request consumes a ref */
4137
4138 if (op_type == OBJ_OP_DISCARD)
4139 result = rbd_img_request_fill(img_request, OBJ_REQUEST_NODATA,
4140 NULL);
4141 else
4142 result = rbd_img_request_fill(img_request, OBJ_REQUEST_BIO,
4143 rq->bio);
4144 if (result)
4145 goto err_img_request;
4146
4147 result = rbd_img_request_submit(img_request);
4148 if (result)
4149 goto err_img_request;
4150
4151 if (must_be_locked)
4152 up_read(&rbd_dev->lock_rwsem);
4153 return;
4154
4155 err_img_request:
4156 rbd_img_request_put(img_request);
4157 err_unlock:
4158 if (must_be_locked)
4159 up_read(&rbd_dev->lock_rwsem);
4160 err_rq:
4161 if (result)
4162 rbd_warn(rbd_dev, "%s %llx at %llx result %d",
4163 obj_op_name(op_type), length, offset, result);
4164 ceph_put_snap_context(snapc);
4165 err:
4166 blk_mq_end_request(rq, errno_to_blk_status(result));
4167 }
4168

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2017-07-28 03:29    [W:0.045 / U:9.092 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site