Skip to content

Commit f35badc

Browse files
committed
Merge tag 'fuse-fixes-6.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse
Pull fuse fix from Miklos Szeredi: "Fix a regression introduced in -rc4" * tag 'fuse-fixes-6.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse: fuse: lock inode unconditionally in fuse_fallocate()
2 parents b7b275e + 44361e8 commit f35badc

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

fs/fuse/file.c

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,11 +2963,9 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
29632963
.mode = mode
29642964
};
29652965
int err;
2966-
bool lock_inode = !(mode & FALLOC_FL_KEEP_SIZE) ||
2967-
(mode & (FALLOC_FL_PUNCH_HOLE |
2968-
FALLOC_FL_ZERO_RANGE));
2969-
2970-
bool block_faults = FUSE_IS_DAX(inode) && lock_inode;
2966+
bool block_faults = FUSE_IS_DAX(inode) &&
2967+
(!(mode & FALLOC_FL_KEEP_SIZE) ||
2968+
(mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_ZERO_RANGE)));
29712969

29722970
if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
29732971
FALLOC_FL_ZERO_RANGE))
@@ -2976,22 +2974,20 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
29762974
if (fm->fc->no_fallocate)
29772975
return -EOPNOTSUPP;
29782976

2979-
if (lock_inode) {
2980-
inode_lock(inode);
2981-
if (block_faults) {
2982-
filemap_invalidate_lock(inode->i_mapping);
2983-
err = fuse_dax_break_layouts(inode, 0, 0);
2984-
if (err)
2985-
goto out;
2986-
}
2977+
inode_lock(inode);
2978+
if (block_faults) {
2979+
filemap_invalidate_lock(inode->i_mapping);
2980+
err = fuse_dax_break_layouts(inode, 0, 0);
2981+
if (err)
2982+
goto out;
2983+
}
29872984

2988-
if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_ZERO_RANGE)) {
2989-
loff_t endbyte = offset + length - 1;
2985+
if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_ZERO_RANGE)) {
2986+
loff_t endbyte = offset + length - 1;
29902987

2991-
err = fuse_writeback_range(inode, offset, endbyte);
2992-
if (err)
2993-
goto out;
2994-
}
2988+
err = fuse_writeback_range(inode, offset, endbyte);
2989+
if (err)
2990+
goto out;
29952991
}
29962992

29972993
if (!(mode & FALLOC_FL_KEEP_SIZE) &&
@@ -3039,8 +3035,7 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
30393035
if (block_faults)
30403036
filemap_invalidate_unlock(inode->i_mapping);
30413037

3042-
if (lock_inode)
3043-
inode_unlock(inode);
3038+
inode_unlock(inode);
30443039

30453040
fuse_flush_time_update(inode);
30463041

0 commit comments

Comments
 (0)