Bug #4184
krbd: fix some sparse problems
0%
Description
The Linux kernel has a tool called "sparse" that scans
the source tree and reports various code problems that
the compiler doesn't otherwise tell you about.
A recent commit I made added a new one of these and
Fenguang Wu sent me an e-mail suggesting I fix it.
He sent me the larger sparse report.
I think these should all just be cleaned up. They're
all small, so I don't think there's any need for a new
issue for each, so I'll just fix as many as I can under
this one issue.
Note that the report below is for the upstream code;
some of these have I think been fixed in newer code
(in the testing branch).
Hi Alex,
FYI, there are new sparse warnings show up in
tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next master
head: cb50a575ec18762cfd26619f8d60b402ed1f81fe
commit: 8d23bf29095e5fab84535035e7a27c4920812c44 rbd: don't assign extent info in rbd_req_sync_op()
date: 4 weeks ago
drivers/block/rbd.c:1370:42: sparse: Using plain integer as NULL pointerdrivers/block/rbd.c:1046:24: sparse: symbol 'rbd_osd_req_op_create' was not declared. Should it be static?
drivers/block/rbd.c:1417:23: sparse: incorrect type in assignment (different base types)
drivers/block/rbd.c:1417:23: expected unsigned long long [unsigned] [usertype] ver
drivers/block/rbd.c:1417:23: got restricted __le64 [usertype] <noident>
drivers/block/rbd.c:1427:46: sparse: Using plain integer as NULL pointer
drivers/block/rbd.c:1480:23: sparse: incorrect type in assignment (different base types)
drivers/block/rbd.c:1480:23: expected unsigned long long [unsigned] [usertype] ver
drivers/block/rbd.c:1480:23: got restricted __le64 [assigned] [usertype] version
drivers/block/rbd.c:1481:26: sparse: incorrect type in assignment (different base types)
drivers/block/rbd.c:1481:26: expected unsigned long long [unsigned] [usertype] cookie
drivers/block/rbd.c:1481:26: got restricted __le64 [usertype] <noident>
drivers/block/rbd.c:2271:19: sparse: symbol 'rbd_dev_create' was not declared. Should it be static?
drivers/block/rbd.c:2815:17: sparse: incorrect type in assignment (different base types)
drivers/block/rbd.c:2815:17: expected restricted __le64 [usertype] snap_id
drivers/block/rbd.c:2815:17: got unsigned long long [unsigned] [long] [long long] <noident>
drivers/block/rbd.c:2816:46: sparse: incorrect type in argument 2 (different base types)
drivers/block/rbd.c:2816:46: expected unsigned long long [unsigned] [usertype] snap_id
drivers/block/rbd.c:2816:46: got restricted __le64 [usertype] snap_id
drivers/block/rbd.c:2819:50: sparse: incorrect type in argument 2 (different base types)
drivers/block/rbd.c:2819:50: expected unsigned long long [unsigned] [usertype] snap_id
drivers/block/rbd.c:2819:50: got restricted __le64 [usertype] snap_id
drivers/block/rbd.c:3835:12: sparse: symbol 'rbd_init' was not declared. Should it be static?
drivers/block/rbd.c:3846:13: sparse: symbol 'rbd_exit' was not declared. Should it be static?
drivers/block/rbd.c:1644:32: sparse: context imbalance in 'rbd_rq_fn' - unexpected unlock
History
#1 Updated by Alex Elder about 11 years ago
- Status changed from New to In Progress
I have resolved all of the reports that remain in the
code currently in the testing branch. There are a
few reports that affect the old rbd code which I did
not address.
I separated most of the fixes into three distinct patches,
one fixing rbd, one fixing the file system code, and one
fixing libceph. There was some extra work required on
the messenger (part of libceph), and I broke that into a
series of smaller patches separate from the reset.
I'm going to test it a bit before posting for review.
#2 Updated by Alex Elder about 11 years ago
- Status changed from In Progress to Fix Under Review
Re-posted for review. The patches have been re-based on
top of fixes for 4234, 4235, 4237, and 4238.
#3 Updated by Alex Elder about 11 years ago
- Target version set to v0.58
Forgot to set target version.
#4 Updated by Alex Elder about 11 years ago
- Status changed from Fix Under Review to Resolved
Josh reviewed these patches, and I have updated, re-tested
and committed them.
cc344fa rbd: eliminate sparse warnings
2c3dd4f ceph: eliminate sparse warnings in fs code
1541716 libceph: eliminate sparse warnings
plus these related cleanups
f20a39f libceph: encapsulate connection backoff
9320926 libceph: separate non-locked fault handling
b6e7b6a libceph: use a flag to indicate a fault has occurred
4965941 libceph: use a do..while loop in con_work()