[DRBD-cvs] svn commit by lars - r2451 - trunk/drbd - grmbl... don't
dereference what is a NULL pointer most
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Sat Sep 23 13:39:57 CEST 2006
Author: lars
Date: 2006-09-23 13:39:56 +0200 (Sat, 23 Sep 2006)
New Revision: 2451
Modified:
trunk/drbd/drbd_req.c
Log:
grmbl... don't dereference what is a NULL pointer most of the time...
Modified: trunk/drbd/drbd_req.c
===================================================================
--- trunk/drbd/drbd_req.c 2006-09-23 10:15:40 UTC (rev 2450)
+++ trunk/drbd/drbd_req.c 2006-09-23 11:39:56 UTC (rev 2451)
@@ -1122,14 +1122,17 @@
limit = AL_EXTENT_SIZE - ((bio_offset & (AL_EXTENT_SIZE-1)) + bio_size);
#endif
if (limit < 0) limit = 0;
- if (limit <= bvec->bv_len && bio_size == 0)
- limit = bvec->bv_len;
-
- if(limit && inc_local(mdev)) {
- backing_limit = mdev->bc->bmbf(q,bio,bvec);
- limit = min(limit,backing_limit);
+ if (bio_size == 0) {
+ if (limit <= bvec->bv_len) limit = bvec->bv_len;
+ } else if (limit && inc_local(mdev)) {
+ /* FIXME
+ * I don't think taking a shortcut is valid, the backing device
+ * is allowed to change its merge bvec function anytime... */
+ if (mdev->bc->bmbf) {
+ backing_limit = mdev->bc->bmbf(q,bio,bvec);
+ limit = min(limit,backing_limit);
+ }
dec_local(mdev);
}
-
return limit;
}
More information about the drbd-cvs
mailing list