diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-04-14 19:53:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-04-14 19:53:45 -0400 |
commit | 4b31ac485daabc50483598500055d63ce5677cc3 (patch) | |
tree | 2b2c316b7cc4fbcbde7e9126cb28df04604d30a5 | |
parent | 5466f4dfce857a7954f19bc9acfc7ca4a73321b6 (diff) | |
parent | a967efb30b3afa3d858edd6a17f544f9e9e46eea (diff) |
Merge branch 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fixes from Chris Mason:
"Dave Sterba collected a few more fixes for the last rc.
These aren't marked for stable, but I'm putting them in with a batch
were testing/sending by hand for this release"
* 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
Btrfs: fix potential use-after-free for cloned bio
Btrfs: fix segmentation fault when doing dio read
Btrfs: fix invalid dereference in btrfs_retry_endio
btrfs: drop the nossd flag when remounting with -o ssd
-rw-r--r-- | fs/btrfs/inode.c | 22 | ||||
-rw-r--r-- | fs/btrfs/super.c | 3 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 2 |
3 files changed, 14 insertions, 13 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index a18510be76c1..5e71f1ea3391 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -7910,7 +7910,6 @@ struct btrfs_retry_complete { | |||
7910 | static void btrfs_retry_endio_nocsum(struct bio *bio) | 7910 | static void btrfs_retry_endio_nocsum(struct bio *bio) |
7911 | { | 7911 | { |
7912 | struct btrfs_retry_complete *done = bio->bi_private; | 7912 | struct btrfs_retry_complete *done = bio->bi_private; |
7913 | struct inode *inode; | ||
7914 | struct bio_vec *bvec; | 7913 | struct bio_vec *bvec; |
7915 | int i; | 7914 | int i; |
7916 | 7915 | ||
@@ -7918,12 +7917,12 @@ static void btrfs_retry_endio_nocsum(struct bio *bio) | |||
7918 | goto end; | 7917 | goto end; |
7919 | 7918 | ||
7920 | ASSERT(bio->bi_vcnt == 1); | 7919 | ASSERT(bio->bi_vcnt == 1); |
7921 | inode = bio->bi_io_vec->bv_page->mapping->host; | 7920 | ASSERT(bio->bi_io_vec->bv_len == btrfs_inode_sectorsize(done->inode)); |
7922 | ASSERT(bio->bi_io_vec->bv_len == btrfs_inode_sectorsize(inode)); | ||
7923 | 7921 | ||
7924 | done->uptodate = 1; | 7922 | done->uptodate = 1; |
7925 | bio_for_each_segment_all(bvec, bio, i) | 7923 | bio_for_each_segment_all(bvec, bio, i) |
7926 | clean_io_failure(BTRFS_I(done->inode), done->start, bvec->bv_page, 0); | 7924 | clean_io_failure(BTRFS_I(done->inode), done->start, |
7925 | bvec->bv_page, 0); | ||
7927 | end: | 7926 | end: |
7928 | complete(&done->done); | 7927 | complete(&done->done); |
7929 | bio_put(bio); | 7928 | bio_put(bio); |
@@ -7973,8 +7972,10 @@ next_block_or_try_again: | |||
7973 | 7972 | ||
7974 | start += sectorsize; | 7973 | start += sectorsize; |
7975 | 7974 | ||
7976 | if (nr_sectors--) { | 7975 | nr_sectors--; |
7976 | if (nr_sectors) { | ||
7977 | pgoff += sectorsize; | 7977 | pgoff += sectorsize; |
7978 | ASSERT(pgoff < PAGE_SIZE); | ||
7978 | goto next_block_or_try_again; | 7979 | goto next_block_or_try_again; |
7979 | } | 7980 | } |
7980 | } | 7981 | } |
@@ -7986,9 +7987,7 @@ static void btrfs_retry_endio(struct bio *bio) | |||
7986 | { | 7987 | { |
7987 | struct btrfs_retry_complete *done = bio->bi_private; | 7988 | struct btrfs_retry_complete *done = bio->bi_private; |
7988 | struct btrfs_io_bio *io_bio = btrfs_io_bio(bio); | 7989 | struct btrfs_io_bio *io_bio = btrfs_io_bio(bio); |
7989 | struct inode *inode; | ||
7990 | struct bio_vec *bvec; | 7990 | struct bio_vec *bvec; |
7991 | u64 start; | ||
7992 | int uptodate; | 7991 | int uptodate; |
7993 | int ret; | 7992 | int ret; |
7994 | int i; | 7993 | int i; |
@@ -7998,11 +7997,8 @@ static void btrfs_retry_endio(struct bio *bio) | |||
7998 | 7997 | ||
7999 | uptodate = 1; | 7998 | uptodate = 1; |
8000 | 7999 | ||
8001 | start = done->start; | ||
8002 | |||
8003 | ASSERT(bio->bi_vcnt == 1); | 8000 | ASSERT(bio->bi_vcnt == 1); |
8004 | inode = bio->bi_io_vec->bv_page->mapping->host; | 8001 | ASSERT(bio->bi_io_vec->bv_len == btrfs_inode_sectorsize(done->inode)); |
8005 | ASSERT(bio->bi_io_vec->bv_len == btrfs_inode_sectorsize(inode)); | ||
8006 | 8002 | ||
8007 | bio_for_each_segment_all(bvec, bio, i) { | 8003 | bio_for_each_segment_all(bvec, bio, i) { |
8008 | ret = __readpage_endio_check(done->inode, io_bio, i, | 8004 | ret = __readpage_endio_check(done->inode, io_bio, i, |
@@ -8080,8 +8076,10 @@ next: | |||
8080 | 8076 | ||
8081 | ASSERT(nr_sectors); | 8077 | ASSERT(nr_sectors); |
8082 | 8078 | ||
8083 | if (--nr_sectors) { | 8079 | nr_sectors--; |
8080 | if (nr_sectors) { | ||
8084 | pgoff += sectorsize; | 8081 | pgoff += sectorsize; |
8082 | ASSERT(pgoff < PAGE_SIZE); | ||
8085 | goto next_block; | 8083 | goto next_block; |
8086 | } | 8084 | } |
8087 | } | 8085 | } |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index da687dc79cce..9530a333d302 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -549,16 +549,19 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options, | |||
549 | case Opt_ssd: | 549 | case Opt_ssd: |
550 | btrfs_set_and_info(info, SSD, | 550 | btrfs_set_and_info(info, SSD, |
551 | "use ssd allocation scheme"); | 551 | "use ssd allocation scheme"); |
552 | btrfs_clear_opt(info->mount_opt, NOSSD); | ||
552 | break; | 553 | break; |
553 | case Opt_ssd_spread: | 554 | case Opt_ssd_spread: |
554 | btrfs_set_and_info(info, SSD_SPREAD, | 555 | btrfs_set_and_info(info, SSD_SPREAD, |
555 | "use spread ssd allocation scheme"); | 556 | "use spread ssd allocation scheme"); |
556 | btrfs_set_opt(info->mount_opt, SSD); | 557 | btrfs_set_opt(info->mount_opt, SSD); |
558 | btrfs_clear_opt(info->mount_opt, NOSSD); | ||
557 | break; | 559 | break; |
558 | case Opt_nossd: | 560 | case Opt_nossd: |
559 | btrfs_set_and_info(info, NOSSD, | 561 | btrfs_set_and_info(info, NOSSD, |
560 | "not using ssd allocation scheme"); | 562 | "not using ssd allocation scheme"); |
561 | btrfs_clear_opt(info->mount_opt, SSD); | 563 | btrfs_clear_opt(info->mount_opt, SSD); |
564 | btrfs_clear_opt(info->mount_opt, SSD_SPREAD); | ||
562 | break; | 565 | break; |
563 | case Opt_barrier: | 566 | case Opt_barrier: |
564 | btrfs_clear_and_info(info, NOBARRIER, | 567 | btrfs_clear_and_info(info, NOBARRIER, |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 73d56eef5e60..ab8a66d852f9 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -6213,7 +6213,7 @@ int btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio, | |||
6213 | for (dev_nr = 0; dev_nr < total_devs; dev_nr++) { | 6213 | for (dev_nr = 0; dev_nr < total_devs; dev_nr++) { |
6214 | dev = bbio->stripes[dev_nr].dev; | 6214 | dev = bbio->stripes[dev_nr].dev; |
6215 | if (!dev || !dev->bdev || | 6215 | if (!dev || !dev->bdev || |
6216 | (bio_op(bio) == REQ_OP_WRITE && !dev->writeable)) { | 6216 | (bio_op(first_bio) == REQ_OP_WRITE && !dev->writeable)) { |
6217 | bbio_error(bbio, first_bio, logical); | 6217 | bbio_error(bbio, first_bio, logical); |
6218 | continue; | 6218 | continue; |
6219 | } | 6219 | } |