Skip to content

Commit

Permalink
Lock the inode in mkwrite.
Browse files Browse the repository at this point in the history
Because we're dropping the s_i_mutex, we're now calling
scoutfs_get_block without the inode being locked.

Rename the local inode_lock variable so it doesn't conflict with the
function call.

Signed-off-by: Auke Kok <[email protected]>
  • Loading branch information
aversecat committed Jul 23, 2024
1 parent a5bd044 commit 2f25eb5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kmod/src/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -1915,6 +1915,7 @@ static int scoutfs_data_page_mkwrite(struct vm_area_struct *vma,
int err;

sb_start_pagefault(sb);
inode_lock(inode);
down_write(&si->extent_sem);

retry:
Expand Down Expand Up @@ -2007,6 +2008,7 @@ static int scoutfs_data_page_mkwrite(struct vm_area_struct *vma,
scoutfs_per_task_del(&si->pt_data_lock, &pt_ent);
scoutfs_unlock(sb, lock, SCOUTFS_LOCK_WRITE);
up_write(&si->extent_sem);
inode_unlock(inode);
if (scoutfs_data_wait_found(&dw)) {
ret = scoutfs_data_wait(inode, &dw);
if (ret == 0)
Expand Down

0 comments on commit 2f25eb5

Please sign in to comment.