diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-08 15:50:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-07-08 15:50:18 -0400 |
commit | 026d15f6b9878794fae1f794cae881ccd65052e5 (patch) | |
tree | d772991739c19d74d6ccdd1c9ae8e1ad72c5e061 /drivers/md/raid1.c | |
parent | 43d012099f5479eb057145f273280ff097f0e73d (diff) | |
parent | 7184ef8bab0cb865c3cea9dd1a675771145df0af (diff) |
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md
Pull MD update from Shaohua Li:
- fixed deadlock in MD suspend and a potential bug in bio allocation
(Neil Brown)
- fixed signal issue (Mikulas Patocka)
- fixed typo in FailFast test (Guoqing Jiang)
- other trival fixes
* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md:
MD: fix sleep in atomic
MD: fix a null dereference
md: use a separate bio_set for synchronous IO.
md: change the initialization value for a spare device spot to MD_DISK_ROLE_SPARE
md/raid1: remove unused bio in sync_request_write
md/raid10: fix FailFast test for wrong device
md: don't use flush_signals in userspace processes
md: fix deadlock between mddev_suspend() and md_write_start()
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 98ca2c1d3226..3febfc8391fb 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1321,7 +1321,6 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, | |||
1321 | * Continue immediately if no resync is active currently. | 1321 | * Continue immediately if no resync is active currently. |
1322 | */ | 1322 | */ |
1323 | 1323 | ||
1324 | md_write_start(mddev, bio); /* wait on superblock update early */ | ||
1325 | 1324 | ||
1326 | if ((bio_end_sector(bio) > mddev->suspend_lo && | 1325 | if ((bio_end_sector(bio) > mddev->suspend_lo && |
1327 | bio->bi_iter.bi_sector < mddev->suspend_hi) || | 1326 | bio->bi_iter.bi_sector < mddev->suspend_hi) || |
@@ -1335,7 +1334,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, | |||
1335 | */ | 1334 | */ |
1336 | DEFINE_WAIT(w); | 1335 | DEFINE_WAIT(w); |
1337 | for (;;) { | 1336 | for (;;) { |
1338 | flush_signals(current); | 1337 | sigset_t full, old; |
1339 | prepare_to_wait(&conf->wait_barrier, | 1338 | prepare_to_wait(&conf->wait_barrier, |
1340 | &w, TASK_INTERRUPTIBLE); | 1339 | &w, TASK_INTERRUPTIBLE); |
1341 | if (bio_end_sector(bio) <= mddev->suspend_lo || | 1340 | if (bio_end_sector(bio) <= mddev->suspend_lo || |
@@ -1345,7 +1344,10 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, | |||
1345 | bio->bi_iter.bi_sector, | 1344 | bio->bi_iter.bi_sector, |
1346 | bio_end_sector(bio)))) | 1345 | bio_end_sector(bio)))) |
1347 | break; | 1346 | break; |
1347 | sigfillset(&full); | ||
1348 | sigprocmask(SIG_BLOCK, &full, &old); | ||
1348 | schedule(); | 1349 | schedule(); |
1350 | sigprocmask(SIG_SETMASK, &old, NULL); | ||
1349 | } | 1351 | } |
1350 | finish_wait(&conf->wait_barrier, &w); | 1352 | finish_wait(&conf->wait_barrier, &w); |
1351 | } | 1353 | } |
@@ -1550,13 +1552,13 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, | |||
1550 | wake_up(&conf->wait_barrier); | 1552 | wake_up(&conf->wait_barrier); |
1551 | } | 1553 | } |
1552 | 1554 | ||
1553 | static void raid1_make_request(struct mddev *mddev, struct bio *bio) | 1555 | static bool raid1_make_request(struct mddev *mddev, struct bio *bio) |
1554 | { | 1556 | { |
1555 | sector_t sectors; | 1557 | sector_t sectors; |
1556 | 1558 | ||
1557 | if (unlikely(bio->bi_opf & REQ_PREFLUSH)) { | 1559 | if (unlikely(bio->bi_opf & REQ_PREFLUSH)) { |
1558 | md_flush_request(mddev, bio); | 1560 | md_flush_request(mddev, bio); |
1559 | return; | 1561 | return true; |
1560 | } | 1562 | } |
1561 | 1563 | ||
1562 | /* | 1564 | /* |
@@ -1571,8 +1573,12 @@ static void raid1_make_request(struct mddev *mddev, struct bio *bio) | |||
1571 | 1573 | ||
1572 | if (bio_data_dir(bio) == READ) | 1574 | if (bio_data_dir(bio) == READ) |
1573 | raid1_read_request(mddev, bio, sectors, NULL); | 1575 | raid1_read_request(mddev, bio, sectors, NULL); |
1574 | else | 1576 | else { |
1577 | if (!md_write_start(mddev,bio)) | ||
1578 | return false; | ||
1575 | raid1_write_request(mddev, bio, sectors); | 1579 | raid1_write_request(mddev, bio, sectors); |
1580 | } | ||
1581 | return true; | ||
1576 | } | 1582 | } |
1577 | 1583 | ||
1578 | static void raid1_status(struct seq_file *seq, struct mddev *mddev) | 1584 | static void raid1_status(struct seq_file *seq, struct mddev *mddev) |
@@ -2165,9 +2171,7 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio) | |||
2165 | struct r1conf *conf = mddev->private; | 2171 | struct r1conf *conf = mddev->private; |
2166 | int i; | 2172 | int i; |
2167 | int disks = conf->raid_disks * 2; | 2173 | int disks = conf->raid_disks * 2; |
2168 | struct bio *bio, *wbio; | 2174 | struct bio *wbio; |
2169 | |||
2170 | bio = r1_bio->bios[r1_bio->read_disk]; | ||
2171 | 2175 | ||
2172 | if (!test_bit(R1BIO_Uptodate, &r1_bio->state)) | 2176 | if (!test_bit(R1BIO_Uptodate, &r1_bio->state)) |
2173 | /* ouch - failed to read all of that. */ | 2177 | /* ouch - failed to read all of that. */ |