diff mbox

[v4,1/3] ext4: Add missing locking around iomap_seek_{hole,data}

Message ID 1499462881-4238-2-git-send-email-agruenba@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andreas Gruenbacher July 7, 2017, 9:27 p.m. UTC
Add back the inode locking that "ext4: Switch to iomap for SEEK_HOLE /
SEEK_DATA" blew away.  We can use inode_lock_shared instead of
inode_lock instead, though.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/ext4/file.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Christoph Hellwig July 12, 2017, 9:17 a.m. UTC | #1
On Fri, Jul 07, 2017 at 11:27:59PM +0200, Andreas Gruenbacher wrote:
> Add back the inode locking that "ext4: Switch to iomap for SEEK_HOLE /
> SEEK_DATA" blew away.  We can use inode_lock_shared instead of
> inode_lock instead, though.

should be folded into that patch.
diff mbox

Patch

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 02bbf2c..699a676 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -459,10 +459,14 @@  loff_t ext4_llseek(struct file *file, loff_t offset, int whence)
 		return generic_file_llseek_size(file, offset, whence,
 						maxbytes, i_size_read(inode));
 	case SEEK_HOLE:
+		inode_lock_shared(inode);
 		offset = iomap_seek_hole(inode, offset, &ext4_iomap_ops);
+		inode_unlock_shared(inode);
 		break;
 	case SEEK_DATA:
+		inode_lock_shared(inode);
 		offset = iomap_seek_data(inode, offset, &ext4_iomap_ops);
+		inode_unlock_shared(inode);
 		break;
 	}