Skip to content

Commit d5b8145

Browse files
author
Andreas Gruenbacher
committed
Revert "gfs2: Fix mmap locking for write faults"
This reverts commit b7f55d9. As explained by Linus in [*], write faults on a mmap region are reads from a filesysten point of view, so taking the inode glock exclusively on write faults is incorrect. Instead, when a page is marked writable, the .page_mkwrite vm operation will be called, which is where the exclusive lock taking needs to happen. I got this wrong because of a broken test case that made me believe .page_mkwrite isn't getting called when it actually is. [*] https://lore.kernel.org/lkml/CAHk-=wj8EWr_D65i4oRSj2FTbrc6RdNydNNCGxeabRnwtoU=3Q@mail.gmail.com/ Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent c2131f7 commit d5b8145

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

fs/gfs2/file.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,11 +540,9 @@ static vm_fault_t gfs2_fault(struct vm_fault *vmf)
540540
struct gfs2_inode *ip = GFS2_I(inode);
541541
struct gfs2_holder gh;
542542
vm_fault_t ret;
543-
u16 state;
544543
int err;
545544

546-
state = (vmf->flags & FAULT_FLAG_WRITE) ? LM_ST_EXCLUSIVE : LM_ST_SHARED;
547-
gfs2_holder_init(ip->i_gl, state, 0, &gh);
545+
gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
548546
err = gfs2_glock_nq(&gh);
549547
if (err) {
550548
ret = block_page_mkwrite_return(err);

0 commit comments

Comments
 (0)