diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 07:13:05 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 07:13:05 +0400 |
commit | 5eea9be8b2478dbc2f9fb1cd6228a90e8dba804e (patch) | |
tree | 8f6443876f45ef448155524d7ce69f6e1616f30c /drivers/block/drbd/drbd_receiver.c | |
parent | 0910c0bdf7c291a41bc21e40a97389c9d4c1960d (diff) | |
parent | f7cb20f03dc6dff1b19942cf3dda6d154c86f29b (diff) | |
download | linux-5eea9be8b2478dbc2f9fb1cd6228a90e8dba804e.tar.xz |
Merge branch 'for-3.13/drivers' of git://git.kernel.dk/linux-block
Pull block driver updates from Jens Axboe:
"This is the block driver pull request for 3.13. As with the core pull
request just sent out, this was rebased on top of the core branch
again after the immutable series was pulled. This also means that
bcache gets to sit the initial pull over. I will send a second driver
pull request in the merge window to get those fixes in, once they have
been rebased and tested on top of the non-immutable stack.
This pull request contains:
- Add support for the sTec Kronos pci-e flash card from sTec. Also
has various cleanups for this driver, from myself, Bart, Mike
Snizter, and Wei Yongjun.
- Add surprise removal support for the micron mtip32xx driver from
Micron.
- Floppy documentation fix from Ben Harris.
- debugfs bug fix for pktcdvd from Dan Carpenter.
- Fix for the mtip32xx driver stack usage in the debugfs path,
dynamically allocating those buffers instead. From David Milburn.
- Disable cpqarray in Kconfig. The plan is to remove it on request
of HP, but lets disable it for a few revisions just to see if
anyone yells.
- drbd fixes from Lars Ellenberg and Philipp Reisner.
- Elevator switch fix for the s390 block driver from Heiko Carstens.
- loop crash fix on IO to unassigned device from Mikulas Patocka.
- A series of bug fixes for the IBM rsxx pci-e flash driver from
Philip J Kelleher.
- cciss probe fix from Stephen Cameron.
- Xen block front/back fixes from Roger Pau Monne and Vegard Nossum"
* 'for-3.13/drivers' of git://git.kernel.dk/linux-block: (41 commits)
floppy: Correct documentation of driver options when used as a module.
pktcdvd: debugfs functions return NULL on error
xen-blkfront: restore the non-persistent data path
skd: fix formatting in skd_s1120.h
skd: reorder construct/destruct code
skd: cleanup skd_do_inq_page_da()
skd: remove SKD_OMIT_FROM_SRC_DIST ifdefs
skd: remove redundant skdev->pdev assignment from skd_pci_probe()
skd: use <asm/unaligned.h>
skd: remove SCSI subsystem specific includes
skd: register block device only if some devices are present
skd: fix error messages in skd_init()
skd: fix error paths in skd_init()
skd: fix unregister_blkdev() placement
skd: more removal of bio-based code
skd: cleanup the skd_*() function block wrapping
skd: rip out bio path
skd: fix error return code in skd_pci_probe()
s390/dasd: hold request queue sysfs lock when calling elevator_init()
cciss: return 0 from driver probe function on success, not 1
...
Diffstat (limited to 'drivers/block/drbd/drbd_receiver.c')
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index cc29cd3bf78b..6fa6673b36b3 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -1890,29 +1890,11 @@ static u32 seq_max(u32 a, u32 b) return seq_greater(a, b) ? a : b; } -static bool need_peer_seq(struct drbd_conf *mdev) -{ - struct drbd_tconn *tconn = mdev->tconn; - int tp; - - /* - * We only need to keep track of the last packet_seq number of our peer - * if we are in dual-primary mode and we have the resolve-conflicts flag set; see - * handle_write_conflicts(). - */ - - rcu_read_lock(); - tp = rcu_dereference(mdev->tconn->net_conf)->two_primaries; - rcu_read_unlock(); - - return tp && test_bit(RESOLVE_CONFLICTS, &tconn->flags); -} - static void update_peer_seq(struct drbd_conf *mdev, unsigned int peer_seq) { unsigned int newest_peer_seq; - if (need_peer_seq(mdev)) { + if (test_bit(RESOLVE_CONFLICTS, &mdev->tconn->flags)) { spin_lock(&mdev->peer_seq_lock); newest_peer_seq = seq_max(mdev->peer_seq, peer_seq); mdev->peer_seq = newest_peer_seq; @@ -1972,22 +1954,31 @@ static int wait_for_and_update_peer_seq(struct drbd_conf *mdev, const u32 peer_s { DEFINE_WAIT(wait); long timeout; - int ret; + int ret = 0, tp; - if (!need_peer_seq(mdev)) + if (!test_bit(RESOLVE_CONFLICTS, &mdev->tconn->flags)) return 0; spin_lock(&mdev->peer_seq_lock); for (;;) { if (!seq_greater(peer_seq - 1, mdev->peer_seq)) { mdev->peer_seq = seq_max(mdev->peer_seq, peer_seq); - ret = 0; break; } + if (signal_pending(current)) { ret = -ERESTARTSYS; break; } + + rcu_read_lock(); + tp = rcu_dereference(mdev->tconn->net_conf)->two_primaries; + rcu_read_unlock(); + + if (!tp) + break; + + /* Only need to wait if two_primaries is enabled */ prepare_to_wait(&mdev->seq_wait, &wait, TASK_INTERRUPTIBLE); spin_unlock(&mdev->peer_seq_lock); rcu_read_lock(); @@ -2228,8 +2219,10 @@ static int receive_Data(struct drbd_tconn *tconn, struct packet_info *pi) } goto out_interrupted; } - } else + } else { + update_peer_seq(mdev, peer_seq); spin_lock_irq(&mdev->tconn->req_lock); + } list_add(&peer_req->w.list, &mdev->active_ee); spin_unlock_irq(&mdev->tconn->req_lock); @@ -4132,7 +4125,11 @@ recv_bm_rle_bits(struct drbd_conf *mdev, (unsigned int)bs.buf_len); return -EIO; } - look_ahead >>= bits; + /* if we consumed all 64 bits, assign 0; >> 64 is "undefined"; */ + if (likely(bits < 64)) + look_ahead >>= bits; + else + look_ahead = 0; have -= bits; bits = bitstream_get_bits(&bs, &tmp, 64 - have); |