Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'gfs2-4.16.rc1.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull gfs2 fix from Bob Peterson:
"Fix regressions in the gfs2 iomap for block_map implementation we
recently discovered in commit 3974320ca6"

* tag 'gfs2-4.16.rc1.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
gfs2: Fixes to "Implement iomap for block_map"

+23 -20
+23 -20
fs/gfs2/bmap.c
··· 716 716 __be64 *ptr; 717 717 sector_t lblock; 718 718 sector_t lend; 719 - int ret; 719 + int ret = 0; 720 720 int eob; 721 721 unsigned int len; 722 722 struct buffer_head *bh; ··· 728 728 goto out; 729 729 } 730 730 731 - if ((flags & IOMAP_REPORT) && gfs2_is_stuffed(ip)) { 732 - gfs2_stuffed_iomap(inode, iomap); 733 - if (pos >= iomap->length) 734 - return -ENOENT; 735 - ret = 0; 736 - goto out; 731 + if (gfs2_is_stuffed(ip)) { 732 + if (flags & IOMAP_REPORT) { 733 + gfs2_stuffed_iomap(inode, iomap); 734 + if (pos >= iomap->length) 735 + ret = -ENOENT; 736 + goto out; 737 + } 738 + BUG_ON(!(flags & IOMAP_WRITE)); 737 739 } 738 740 739 741 lblock = pos >> inode->i_blkbits; ··· 746 744 iomap->type = IOMAP_HOLE; 747 745 iomap->length = (u64)(lend - lblock) << inode->i_blkbits; 748 746 iomap->flags = IOMAP_F_MERGED; 749 - bmap_lock(ip, 0); 747 + bmap_lock(ip, flags & IOMAP_WRITE); 750 748 751 749 /* 752 750 * Directory data blocks have a struct gfs2_meta_header header, so the ··· 789 787 iomap->flags |= IOMAP_F_BOUNDARY; 790 788 iomap->length = (u64)len << inode->i_blkbits; 791 789 792 - ret = 0; 793 - 794 790 out_release: 795 791 release_metapath(&mp); 796 - bmap_unlock(ip, 0); 792 + bmap_unlock(ip, flags & IOMAP_WRITE); 797 793 out: 798 794 trace_gfs2_iomap_end(ip, iomap, ret); 799 795 return ret; 800 796 801 797 do_alloc: 802 - if (!(flags & IOMAP_WRITE)) { 803 - if (pos >= i_size_read(inode)) { 798 + if (flags & IOMAP_WRITE) { 799 + ret = gfs2_iomap_alloc(inode, iomap, flags, &mp); 800 + } else if (flags & IOMAP_REPORT) { 801 + loff_t size = i_size_read(inode); 802 + if (pos >= size) 804 803 ret = -ENOENT; 805 - goto out_release; 806 - } 807 - ret = 0; 808 - iomap->length = hole_size(inode, lblock, &mp); 809 - goto out_release; 804 + else if (height <= ip->i_height) 805 + iomap->length = hole_size(inode, lblock, &mp); 806 + else 807 + iomap->length = size - pos; 808 + } else { 809 + if (height <= ip->i_height) 810 + iomap->length = hole_size(inode, lblock, &mp); 810 811 } 811 - 812 - ret = gfs2_iomap_alloc(inode, iomap, flags, &mp); 813 812 goto out_release; 814 813 } 815 814