diff options
| author | Jason Gunthorpe <jgg@nvidia.com> | 2023-10-31 10:54:48 -0300 |
|---|---|---|
| committer | Jason Gunthorpe <jgg@nvidia.com> | 2023-10-31 10:54:48 -0300 |
| commit | 162e3480246ef69386d4647d2320d86741bf08a2 (patch) | |
| tree | caada42ce40114e7abe5e74acb54781ad4aa424a /fs/buffer.c | |
| parent | d4b2d165714c0ce8777d5131f6e0aad617b7adc4 (diff) | |
| parent | ffc253263a1375a65fa6c9f62a893e9767fbebfa (diff) | |
Merge tag 'v6.6' into rdma.git for-next
Resolve conflict by taking the spin_lock hunk from for-next:
https://lore.kernel.org/r/20230928113851.5197a1ec@canb.auug.org.au
Required for the next patch.
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'fs/buffer.c')
| -rw-r--r-- | fs/buffer.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index a6785cd07081..12e9a71c693d 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2058,8 +2058,17 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh, fallthrough; case IOMAP_MAPPED: if ((iomap->flags & IOMAP_F_NEW) || - offset >= i_size_read(inode)) + offset >= i_size_read(inode)) { + /* + * This can happen if truncating the block device races + * with the check in the caller as i_size updates on + * block devices aren't synchronized by i_rwsem for + * block devices. + */ + if (S_ISBLK(inode->i_mode)) + return -EIO; set_buffer_new(bh); + } bh->b_blocknr = (iomap->addr + offset - iomap->offset) >> inode->i_blkbits; set_buffer_mapped(bh); |
